hasura / eff

🚧 a work in progress effect system for Haskell 🚧
ISC License
551 stars 18 forks source link

Nix setup #10

Open turion opened 4 years ago

turion commented 4 years ago

It would be great if there was a shell.nix that pulls in the GHC fork required for this library to build properly. Then nix users can simply start developing by executing:

nix-shell
cabal build

If you want, I can set that up. I just need the link to your custom GHC.

lexi-lambda commented 4 years ago

I’ve pushed a commit that links to my implementation branch in the README, but here’s a direct link as well: https://gitlab.haskell.org/lexi.lambda/ghc/-/commits/first-class-continuations

turion commented 4 years ago

@lexi-lambda Thanks! I'm working on it. Do all dependencies (including base) need to be rebuild with your GHC branch as well?

lexi-lambda commented 4 years ago

Yes, but that isn’t really due to any particular property of my branch, I don’t think. To my knowledge, GHC doesn’t like it if you try to use any libraries compiled with other GHC versions, since there’s no guarantee they would be in any way compatible! So GHC demands that the compiler versions in the interface files match exactly, regardless of whether or not it would actually cause a problem.

turion commented 3 years ago

Sorry for the long break. I'm finding this difficult because it's not so straightforward to override a GHC source in nixpkgs correctly. If anyone knows how this works properly, do let me know.

layus commented 3 years ago

I found a related, very complete article about patching GHC at https://mpickering.github.io/posts/2018-01-05-ghchead-nix.html

i would be glad to help you if you need someone to test, debug and possibly provide advice during your progress. Do you have any code somewhere ?

turion commented 3 years ago

@layus Thank you, that's very kind! You can find my work-in-progress here: https://github.com/turion/eff/blob/dev_nix/default.nix

I read the article you posted. It's very informative. However, it only seems to answer how to apply certain patches to GHC HEAD, whereas I want to specify the complete source. I think I succeeded halfway, but I'm running into this error in stage 2:

compiler/stage2/build/GHC/Parser/Lexer.hs:3495:3: error:
    Variable not in scope: int16ToInt# :: Int# -> Int#
     |
3495 |   int16ToInt#
     |   ^^^^^^^^^^^

compiler/stage2/build/GHC/Parser/Lexer.hs:3520:3: error:
    Variable not in scope: int32ToInt# :: Int# -> Int#
     |
3520 |   int32ToInt#
     |   ^^^^^^^^^^^

Possibly, this is a real build error, and not an error in my setup. I'm not sure.

layus commented 3 years ago

The problem you encounter is described here. Not too sure how to dowgrade alex, or merge ghc upstream patches in there. but either should solve the issue.

https://www.mail-archive.com/ghc-devs@haskell.org/msg19126.html

layus commented 3 years ago

@layus Thank you, that's very kind! You can find my work-in-progress here: https://github.com/turion/eff/blob/dev_nix/default.nix

I read the article you posted. It's very informative. However, it only seems to answer how to apply certain patches to GHC HEAD, whereas I want to specify the complete source.

But you can always convert the ghc/eff branch to a patch and apply that cleanly on top of any compatible ghc version. It should work on top of ghcHead and avoid the above issue altogether.