her.esy.fun/src/Scratch/en/blog/Safer-Haskell-Install/index.html

136 lines
9.5 KiB
HTML
Raw Normal View History

2021-04-18 10:23:24 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>YBlog - Safer Haskell Install</title>
<meta name="keywords" content="programming" />
<link rel="shortcut icon" type="image/x-icon" href="../../../../Scratch/img/favicon.ico" />
2021-05-25 20:25:47 +00:00
<link rel="stylesheet" type="text/css" href="/css/y.css" />
<link rel="stylesheet" type="text/css" href="/css/legacy.css" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="/rss.xml" />
2021-04-18 10:23:24 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="../../../../Scratch/img/about/FlatAvatar@2x.png" />
<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
<![endif]-->
<!-- IndieAuth -->
2023-06-30 20:54:00 +00:00
<link href="https://ieji.de/@yogsototh" rel="me">
2021-04-18 10:23:24 +00:00
<link href="https://github.com/yogsototh" rel="me">
<link href="mailto:yann.esposito@gmail.com" rel="me">
<link rel="pgpkey" href="../../../../pubkey.txt">
</head>
<body lang="en" class="article">
<div id="content">
<div id="header">
<div id="choix">
<span id="choixlang">
<a href="../../../../Scratch/fr/blog/Safer-Haskell-Install/">French</a>
</span>
<span class="tomenu"><a href="#navigation">↓ Menu ↓</a></span>
<span class="flush"></span>
</div>
</div>
<div id="titre">
<h1>Safer Haskell Install</h1>
</div>
<div class="flush"></div>
<div id="afterheader" class="article">
<div class="corps">
<div>
<img src="../../../../Scratch/img/blog/Safer-Haskell-Install/main.jpg" alt="to Haskell and Beyond!!!" />
</div>
<div class="intro">
<p><span class="sc"><abbr title="Too long; didn't read">tl;dr</abbr>: </span> Install Haskell (OS X and Linux only) by pasting the following in your terminal:</p>
<pre><code>curl https://raw.githubusercontent.com/yogsototh/install-haskell/master/install-haskell.sh | sudo zsh</code></pre>
<p><em>update (28 march 2015): I now use <a href="http://www.stackage.org/lts">Haskell LTS</a> instead of a random stackage version.</em></p>
<p>If you are on windows, just download the Haskell Platform and follow the instruction to use <a href="http://www.stackage.org/lts">Haskell LTS</a>.</p>
<p>If you want to know the why and the how; you should read the entire article.</p>
</div>
<h2 id="why">Why?</h2>
<p>The main weakness of Haskell as nothing to do with the language itself but with its ecosystem<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a>.</p>
<p>The main problem Ill try to address is the one known as <em>cabal hell</em>. The community is really active in fixing the issue. I am very confident that in less than a year this problem will be one of the past. But to work today, I provide an install method that should reduce greatly two effects of cabal hell:</p>
<ul>
<li>dependency error</li>
<li>lost time in compilation (poor polar bears)</li>
</ul>
<p>With my actual installation method, you should minimize your headache and almost never hit a dependency error. But there could exists some. If you encounter any dependency error, ask gently to the package manager to port its package to <a href="http://www.stackage.org">stackage</a>.</p>
<p>So to install copy/paste the following three lines in your terminal:</p>
<pre><code>curl https://raw.githubusercontent.com/yogsototh/install-haskell/master/install-haskell.sh | sudo zsh</code></pre>
<h2 id="how">How?</h2>
<p>You can read the script and you will see that this is quite straightforward.</p>
<ol type="1">
<li>It downloads the latest <code>GHC</code> binary for you system and install it.</li>
<li>It does the same with the <code>cabal</code> program.</li>
<li>It updates your cabal config file to use <a href="http://www.stackage.org/lts">Haskell LTS</a>.</li>
<li>It enable profiling to libraries and executables.</li>
<li>It installs some useful binaries that might cause compilation error if not present.</li>
</ol>
<p>As the version of libraries is fixed up until you update the <a href="http://www.stackage.org/lts">Haskell LTS</a> version, you should never use cabal sandbox. That way, you will only compile each needed library once. The compiled objects/binaries will be in your <code>~/.cabal</code> directory.</p>
<h2 id="some-last-words">Some Last Words</h2>
<p>This script use the latest <a href="http://www.stackage.org/lts">Haskell LTS</a>. So if you use this script at different dates, the Haskell LTS might have changed.</p>
<p>While it comes to cabal hell, some solutions are sandboxes and <code>nix</code>. Unfortunately, sandboxes didnt worked good enough for me after some time. Furthermore, sandboxes forces you to re-compile everything by project. If you have three yesod projects for example it means a lot of time and CPU. Also, <code>nix</code> didnt worked as expected on OS X. So fixing the list of package to a stable list of them seems to me the best pragmatic way to handle the problem today.</p>
<p>From my point of view, <a href="http://www.stackage.org/lts">Haskell LTS</a> is the best step in the right direction. The actual cabal hell problem is more a human problem than a tool problem. This is a bias in most programmer to prefer resolve social issues using tools. There is nothing wrong with hackage and cabal. But for a package manager to work in a static typing language as Haskell, packages must work all together. This is a great strength of static typed languages that they ensure that a big part of the API between packages are compatible. But this make the job of package managing far more difficult than in dynamic languages.</p>
<p>People tend not to respect the rules in package numbering<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a>. They break their API all the time. So we need a way to organize all of that. And this is precisely what <a href="http://www.stackage.org/lts">Haskell LTS</a> provide. A set of stable packages working all together. So if a developer break its API, it wont work anymore in stackage. And whether the developer fix its package or all other packages upgrade their usage. During this time, <a href="http://www.stackage.org/lts">Haskell LTS</a> end-users will be able to develop without dependency issues.</p>
<hr />
<p class="small">
<a href="https://www.flickr.com/photos/nesster/4198442186/">The image of the cat about to jump that I slightly edited can found here</a>
</p>
<section class="footnotes">
<hr />
<ol>
<li id="fn1"><p>By ecosystem of a language I mean, the community, the tools, the documentations, the deployment environments, the businesses using the language, etc… Mainly everything that has nothing to do with the detail of a programming language but has to do on how and why we use it.<a href="#fnref1" class="footnote-back"></a></p></li>
<li id="fn2"><p>I myself am guilty of such behavior. It was a beginner error.<a href="#fnref2" class="footnote-back"></a></p></li>
</ol>
</section>
</div>
<div id="afterarticle">
<div id="social">
2021-05-25 20:25:47 +00:00
<a href="/rss.xml" target="_blank" rel="noopener noreferrer nofollow" class="social">RSS</a>
2021-04-18 10:23:24 +00:00
·
<a href="https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/Safer-Haskell-Install/%20via%20@yogsototh" target="_blank" rel="noopener noreferrer nofollow" class="social">Tweet</a>
·
<a href="http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/en/blog/Safer-Haskell-Install/" target="_blank" rel="noopener noreferrer nofollow" class="social">FB</a>
<br />
<a class="message" href="../../../../Scratch/en/blog/Social-link-the-right-way/">These social sharing links preserve your privacy</a>
</div>
<div id="navigation">
<a href="../../../../">Home</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/blog">Blog</a>
<span class="sep">¦</span>
<a href="../../../../Scratch/en/softwares">Softwares</a>
<span class="sep">¦</span>
2023-05-10 06:39:11 +00:00
<a href="/about-me.html">About</a>
2021-04-18 10:23:24 +00:00
</div>
<div id="totop"><a href="#header">↑ Top ↑</a></div>
<div id="bottom">
<div>
Published on 2014-08-16
</div>
<div>
2023-06-30 20:54:00 +00:00
<a href="https://ieji.de/@yogsototh">Follow @yogsototh@ieji.de</a>
2021-04-18 10:23:24 +00:00
</div>
<div>
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Esposito©</a>
</div>
<div>
Done with
<a href="http://www.vim.org" target="_blank" rel="noopener noreferrer nofollow"><strike>Vim</strike></a>
<a href="http://spacemacs.org" target="_blank" rel="noopener noreferrer nofollow">spacemacs</a>
<span class="pala">&amp;</span>
<a href="http://nanoc.ws" target="_blank" rel="noopener noreferrer nofollow"><strike>nanoc</strike></a>
<a href="http://jaspervdj.be/hakyll" target="_blank" rel="noopener noreferrer nofollow">Hakyll</a>
</div>
2022-10-26 09:26:08 +00:00
2021-04-18 10:23:24 +00:00
</div>
</div>
</div>
</div>
</body>
</html>