-
Notifications
You must be signed in to change notification settings - Fork 82
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
Make it compile with MicroHs #262
Conversation
What's the best way of testing this? I'm worried this will break if it's not tested in CI. |
I meant to add it to CI, but I forgot to do that. I'll do that soon. |
Your CI failed. Looks like a shell arg-quoting issue or something. |
Yes. It needed a newer mhs version. It's now using stable-2 instead of stable-1. |
Can you get CI to run the main test suite? |
I'm not sure. Does the other CI stuff do that? |
I think it's a big fiddly to get it to run as part of the test suite. |
Ubuntu, MacOS, Windows and FreeBSD CI all run tests. WASM does not, because apparently tasty isn't supported, though it does run the (very small) ShowTime and ShowDefaultTZAbbreviations tests. |
Does MicroHs work with cabal? |
I misunderstood. No, MHS can't run the test suite. It needs more stuff, e.g., tasty. |
"Does MicroHs work with Cabal?"
I've made MicroCabal which can use MHS (and GHC) to build stuff. |
I've found some problems that I have to fix, so don't merge my changes yet. |
OK, I've converted it to draft. Convert it back when it's ready. |
I think my changes are ready to be merged. |
I take it |
I don't know what format-all does, but I can test it. It uses stack, which I don't. But I'll install stack and see what happens. |
It runs |
Hmm, looks like |
Thanks! Btw, I really hate adding CPP, but I don't know any other way. As MicroHaskell gets more features, some of them can be removed again. |
(Just passing by) CPP can be done a little bit better using newtype Month = MkMonth Integer deriving (Eq, Ord, Data, Typeable
#if __GLASGOW_HASKELL__
, TH.Lift, Generic
#endif
) one can write newtype Month = MkMonth Integer deriving (Eq, Ord, Data, Typeable)
#if __GLASGOW_HASKELL__
deriving instance TH.Lift Month
deriving instance Generic Month
#endif This way CPP does not appear in the middle of declaration, making it easier for formatters and such simply ignore it. As for |
Yup, currently working on this. |
Yeah the patterns are really annoying. Possibly it would have been better to wait for pattern synonyms support. |
Adding parsing of pattern synonyms should be pretty easy. And then just ignoring them for now. |
That would be very helpful. The instance deriving is no problem, I can use @Bodigrim's method or even this:
|
Actually, I could fake having deriving for TH.Lift and Generic as well. That would make for even fewer changes. |
Regarding pattern synonyms. It's easy to just ignore the definitions to avoid CPP. But the synonyms are also frequently used, and those will still need CPP. |
Yeah that seems unavoidable, though in some cases I may be able to rewrite them. Of course, you could just actually implement pattern synonyms in MicroHs... |
Three kinds of changes: