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

Various changes to enable cross-compilation #147

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

georgefst
Copy link

Obviously this isn't mergeable in its current state. But I figured I'd leave it here as a draft in case anyone else wants to cross-compile this library.

In the longer run, would you consider using generic-lens over TH? And perhaps some different approach to doctests which doesn't require a custom setup.

…rpreter`)

As it stands, we also need changes to `entropy`, but I'll manage that separately. Hopefully by reviving haskell/entropy#20.

Note that the custom setup is only used for `cabal-doctest`, so we really can just safely remove it. This is essentially the same issue as cdepillabout/pretty-simple#82.

Seeing as all the TH is just for `makeLenses`, in an ideal world we really ought to just be able to run on the host: see ghc-proposals/ghc-proposals#243.

The changes to the two `.hs` files are from dumping the TH splices (and manually (well, with _some_ help from HLS) adding a load of qualified imports). The splices can be found in `dist-newstyle` after adding this to `cabal.project`:

```
package wreq
    ghc-options: -ddump-splices -dth-dec-file
```
@ondrap
Copy link
Collaborator

ondrap commented Apr 17, 2022

Open to any suggestions :) If you make a PR that make things better...
The doctests are a little annoying, yes...
I'd think generic-lens would be fine, I guess the problem with cross-compilation is TH?

@georgefst
Copy link
Author

I mentioned some of this in the commit message, in case you missed it.

The doctests are a little annoying, yes...

Yeah, the doctest situation in Haskell is a (possibly improving?) mess. I've lost track of best practice. It's a bit mad that we have a situation where tests which we don't actually run can make a library harder to compile.

I'd think generic-lens would be fine

Ok, I'll see if I can put up a more polished PR for that.

I guess the problem with cross-compilation is TH?

Indeed.

@georgefst
Copy link
Author

I'd think generic-lens would be fine

Ok, I'll see if I can put up a more polished PR for that.

I've taken a stab at this in georgefst@032d556, but there are several caveats, outlined in the commit message.

All can ultimately be overcome. Though one would require a small upstream change (snoyberg/http-client#451). Regardless, I'm not inclined to return to this in the near future.

It's also still fairly verbose, and might be no more maintainable in practice then writing the instances by hand instead.

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

Successfully merging this pull request may close these issues.

2 participants