Skip to content

Instantly share code, notes, and snippets.

@Huxpro
Created November 10, 2018 07:18
Show Gist options
  • Save Huxpro/41fb786e69c641520a90e3cd466abec8 to your computer and use it in GitHub Desktop.
Save Huxpro/41fb786e69c641520a90e3cd466abec8 to your computer and use it in GitHub Desktop.

Hi folks, I just wanna share my story on my first day trying Cabal/Stack.

So I was learning Haskell for half a semester but only live within ghci and runhaskell. But today I was thinking of playing with /write-you-a-haskell/chapter4/untyped so I pulled it down.

I was first trying to follow the README.md which asked me to do cabal run. It failed and gave me errors on the ambiguous usage of <>, I realized cabal is using my global GHC version and it might be some breaking changes there. (since it's Haskell)

I heard stack can solve this problem by having multiple GHC so I changed to looking into that. So I run stack build, see the new GHC being downloaded, but failed. The resolver of the project is 7.8.4 and the problem is ar permission errors on OS X 10.11 El Capitan with GHC 7.8.4 . I tried several workarounds posted in the issue page but none of them works.

After a while, I realized why not just change the GHC version? I changed the resolver to 7.10.2 and as I expected, there is no more ar permission problem but only some dependencies unmatching version errors. I picked one suggestion given by stack that is adding allow-newer: true into the stack.yaml. Not sure if it's really safe but after that it finally built!

I was like super happy and eagerly run the stack exec untyped (since the executable field in untyped.cabal file is untyped). But it complained Executable ... not found

I checked the .stack-work and found the executable has actually built under the dist dir, but the stack is looking for the install/.../bin which does not even exist in my case lol.

Well, I stopped here since I really have no idea what should I do next now. I even tried with resolve 8.2.1 but ended up with the same result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment