Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix setup #10

Open
turion opened this issue Jun 19, 2020 · 8 comments
Open

Nix setup #10

turion opened this issue Jun 19, 2020 · 8 comments

Comments

@turion
Copy link

turion commented Jun 19, 2020

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
Copy link
Contributor

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
Copy link
Author

turion commented Jun 28, 2020

@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
Copy link
Contributor

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
Copy link
Author

turion commented Feb 15, 2021

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
Copy link

layus commented Feb 15, 2021

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
Copy link
Author

turion commented Feb 16, 2021

@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
Copy link

layus commented Feb 16, 2021

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
Copy link

layus commented Feb 16, 2021

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants