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

GHCJS typechecker plugins #626

Open
zarybnicky opened this issue Jan 27, 2020 · 4 comments
Open

GHCJS typechecker plugins #626

zarybnicky opened this issue Jan 27, 2020 · 4 comments

Comments

@zarybnicky
Copy link

I'm trying to use plugins in my Reflex experiments. While I dimly recall reading somewhere that GHCJS doesn't support plugins, that might've been a long time ago as I can't find that information again anywhere, and from reading the Nix files, I got the impression that Reflex.Optimizer is usable when compiling with GHCJS as well.

In particular I'm having trouble compiling ghc-tcplugins-extra due to its ghc dependency - I did manage to discover ghc-api-ghcjs by thorough Googling, but patching ghc-tcplugins-extra to look for ghc-api-ghcjs instead of ghc doesn't help (Encountered missing dependencies: ghc-api-ghcjs -any).

It seems to me that ghc-api-ghcjs is getting compiled with GHC 8.6.4 - the full path to the .so is /nix/store/2cx3p3ywpzz47f23zw3i1ssdjfddjjjw-ghc-api-ghcjs-8.6.5/lib/ghc-8.6.4/x86_64-linux-ghc-8.6.4/libHSghc-api-ghcjs-8.6.5-F0KeWR7UxRl4rynnmWSnQM-ghc8.6.4.so (note the two ghc-8.6.4), but I can't find where this is coming from. I'd assume it's the ghcjs-ng machinery inside nixpkgs, but that is as far as I got...

I did see that using Reflex.Optimizer with GHCJS adds an extra ghcLibdir (ghcLibdir = "${self.ghc.bootPackages.ghcWithPackages (p: [ p.reflex ])}/lib/${self.ghc.bootPackages.ghc.name}";), but I didn't manage to make it work for other plugins.

My ultimate goal is to get ghc-typelits-knownnat, ghc-typelits-normalize, and polysemy-plugin working in GHCJS, but that seems a long way off right now...

@zarybnicky
Copy link
Author

Also a clue as to whether GHCJS plugins are supported is ghcjs/ghcjs@e36e50a, where I can see 'something' that touches plugins.

I'd assume that the thing to do is to compile the plugins with GHC and pass them through to GHCJS via ghcLibdir, manually dropping the ghc (or ghc-tcplugins-extra or whatever) dependency via callCabal2nix "pkg" src { ghc = null; } - am I on the right track?

@locallycompact
Copy link

Hi @zarybnicky. I'm also trying to get polysemy-plugin to work with GHCJS, did you discover anything more about this?

@zarybnicky
Copy link
Author

@locallycompact No progress to report, no. I did discover that IOHK used to use GHC plugins with GHCJS, but it wasn't a straightforward process and I instead postponed the reflex+polysemy project indefinitely... 🤷‍♂️ Nowadays, I'd say eff, or one of the effect system alternatives that don't require a plugin would be cleaner - but the ghc-typelits-* plugins are still something desirable.

@locallycompact
Copy link

Polysemy doesn't require the plugin to work, it just saves on type applications, but thanks for trying this and reporting!

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

2 participants