<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.Code, li.Code, div.Code
        {mso-style-name:Code;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:14.2pt;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        font-weight:bold;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.gmail-m-4734454596412187589gmail-m-1866220934865054569code, li.gmail-m-4734454596412187589gmail-m-1866220934865054569code, div.gmail-m-4734454596412187589gmail-m-1866220934865054569code
        {mso-style-name:gmail-m_-4734454596412187589gmail-m-1866220934865054569code;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
.MsoPapDefault
        {mso-style-type:export-only;
        margin-top:6.0pt;
        margin-right:0cm;
        margin-bottom:6.0pt;
        margin-left:0cm;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">That’s a tremendously helpful summary, thank you Iavor.  And Michail’s summary was also very helpful.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Most of this is doubtless well-known to habitual cabal users, but it might be useful to explain the user model, in a way that covers these points, somewhere close to the Cabal home page.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Simon<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Iavor Diatchki <iavor.diatchki@gmail.com>
<br>
<b>Sent:</b> 15 April 2019 23:39<br>
<b>To:</b> Simon Peyton Jones <simonpj@microsoft.com><br>
<b>Cc:</b> Brandon Allbery <allbery.b@gmail.com>; ghc-devs@haskell.org<br>
<b>Subject:</b> Re: Cabal woes<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
Hello,<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
in case it is useful, here is how I think about what's happening with cabal.   At present, `cabal-install` supports two different modes of operation: the old style (aka `v1`) and the new style (aka `v2`) and---at least for me---the two require a slightly different
 mental model of what is going on.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
In the old model, there is a user package database, and users would use "cabal install" to install libraries their manually (e.g., using `cabal-install`).   Later, when building various artifacts cabal would prefer using the packages installed in the user's
 database.  This database supported having multiple versions of a package, but NOT multiple builds of the same version of a package (e.g., against different dependencies).  As a result, builds would sometimes fail, because the dependencies of packages would
 clash with each other (the unfortunate "cabal hell").<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
With the new model, there is still a "user" level location where libraries are installed, but it is not really directly manipulated by the user---rather it acts as more of a "cache" containing all versions of all libraries every built and---crucially---it supports
 having multiple builds of the same version of a package against different dependencies.   When users build an artifact using the new style (aka "v2"), cabal automatically checks if a suitable version of the library is already built in its cache, and if not
 it adds it there.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
The important difference between the two (at least in my mind) is that with the new style, you never just install a library on its own.  Rather, you install it as a part of a project, so Cabal can compute which version it should install so that you get a version
 compatible with the rest of the project.   Since in this model you never really install libraries directly, the `install` command defaults to installing executables, which is what the first error is trying to say.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
So, if you want to try out `hspec` with the `v2` style of Cabal, you'd just add it as a dependencies in the `cabal` file of your project, and then use `cabal v2-build` to build the project, without having to install it manually first.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
I hope this helps,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
-Iavor<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
<o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:6.0pt;margin-right:0cm;margin-bottom:6.0pt;margin-left:0cm">
On Mon, Apr 15, 2019 at 3:01 PM Simon Peyton Jones via ghc-devs <<a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Thanks.  But alas I have no clue about whether I want a v1-install or a v2-install, nor how to achieve them if I knew what they were.  I just want to install ‘hspec’ so that I can
 use it when compiling a program.  How would I do that?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">The instructions here
<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.haskell.org%2FCabal-Install&data=02%7C01%7Csimonpj%40microsoft.com%7Ce83dcc16b5a542b8a9b008d6c1f32668%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636909647403187221&sdata=l5Ft4P6VmYcKSMACJWRjQs%2BxeA6LTAj74qTmCakhbPU%3D&reserved=0" target="_blank">
https://wiki.haskell.org/Cabal-Install</a> just say “cabal install hspec” which is what I tried.  Those instructions are pointed to from here
<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.haskell.org%2FCabal%2FHow_to_install_a_Cabal_package&data=02%7C01%7Csimonpj%40microsoft.com%7Ce83dcc16b5a542b8a9b008d6c1f32668%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636909647403197230&sdata=1uversp%2FCN3h2q0VVmp97WsdnuiHyAl%2B0UfrH0r%2FFek%3D&reserved=0" target="_blank">
https://wiki.haskell.org/Cabal/How_to_install_a_Cabal_package</a>, which in turn are pointed to from the main Cabal home page
<a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.haskell.org%2Fcabal%2F&data=02%7C01%7Csimonpj%40microsoft.com%7Ce83dcc16b5a542b8a9b008d6c1f32668%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636909647403207238&sdata=1jW3cLEe144ky%2F40Lh4ObiTQQT22TSyhEB03V1Zi09E%3D&reserved=0" target="_blank">
https://www.haskell.org/cabal/</a>.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I must be missing something.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Simon<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Brandon Allbery <<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>>
<br>
<b>Sent:</b> 15 April 2019 22:54<br>
<b>To:</b> Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>><br>
<b>Cc:</b> <a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<b>Subject:</b> Re: Cabal woes</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:6.0pt">I think you wanted v1-install to install a library into the user package database, since your cabal is 3.x and the v2-* commands are now the default (that is, you did what used to be cabal
 new-install or cabal v2-install). <o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:6.0pt"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:6.0pt">On Mon, Apr 15, 2019 at 5:47 PM Simon Peyton Jones via ghc-devs <<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I’m trying to install ‘hspec’ on my WSL (Windows subsystem for Linux) system.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">But I fail; see below.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">For some reason cabal complains about installing a library.  (That seems peculiar – isn’t that what cabal is for?)  But it helpfully suggests adding –lib. 
<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Alas, cabal then crashes outright, which should never happen.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">So I’m stuck.  What should I do?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Thanks<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Simon<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">simonpj@MSRC-9870733:~$ cabal --version<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">cabal-install version 3.0.0.0<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">compiled using version 3.0.0.0 of the Cabal library
<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">simonpj@MSRC-9870733:~$ cabal install hspec<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">Resolving dependencies...<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">Up to date<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">Warning: You asked to install executables, but there are no executables in<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">target: hspec. Perhaps you want to use --lib to install libraries instead.<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">simonpj@MSRC-9870733:~$ cabal install --lib hspec<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">Resolving dependencies...<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">Up to date<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">Distribution/Simple/GHC.hs:1959:5-56: Irrefutable pattern failed for pattern Just ghcPkgProg<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code"> <o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">simonpj@MSRC-9870733:~$ which ghc<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">/opt/ghc/bin/ghc<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">simonpj@MSRC-9870733:~$ which ghc-pkg<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">/opt/ghc/bin/ghc-pkg<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code">simonpj@MSRC-9870733:~$<o:p></o:p></p>
<p class="gmail-m-4734454596412187589gmail-m-1866220934865054569code"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-devs&data=02%7C01%7Csimonpj%40microsoft.com%7Ce83dcc16b5a542b8a9b008d6c1f32668%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636909647403207238&sdata=T7Eo7enHHyPOq5SNk0OFG2PriAX4aUpizF4x1Z4FBbE%3D&reserved=0" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">--
<o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">brandon s allbery kf8nh<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-devs&data=02%7C01%7Csimonpj%40microsoft.com%7Ce83dcc16b5a542b8a9b008d6c1f32668%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636909647403217243&sdata=4blF2DgTxLi%2FNPWWZBbzdOQ6kAiKi6Pqjqm6U1qMEro%3D&reserved=0" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</body>
</html>