-
Notifications
You must be signed in to change notification settings - Fork 178
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 make it compile with MicroHs. #1043
base: master
Are you sure you want to change the base?
Conversation
Mostly #ifdefs and some type signatures.
Thank you! This is a very welcome development. I don't see any changes to CI. Could we at least compile the library on MicroHS in CI, even if dependencies don't yet let us compile the test suite? |
Hmm. That's a good idea. I will have to look into how easy it is.
Can CI compile other Hackage packages?
…On Thu, Sep 19, 2024 at 2:06 PM David Feuer ***@***.***> wrote:
Thank you! This is a very welcome development. I don't see any changes to
CI. Could we at least compile the library on MicroHS in CI, even if
dependencies don't yet let us compile the test suite?
—
Reply to this email directly, view it on GitHub
<#1043 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABIARHUNDCBYRVTVWYG6S53ZXK45NAVCNFSM6AAAAABOPRDUIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRQHAYDSOJSGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I imagine so, though I'm not at all an expert in the ways of |
What exactly are the differences between getting something to compile on GHC and MicroHs. It seems to be mostly about certain modules not available in MicroHs And +1 on having a CI so we don't break this in the future. |
By the way, I am having to manually approve these CI runs. It seems that this is the default for "first time contributors" and I don't see a way to change it. treeowl could you peek at the settings to see if we can change this (perhaps temporarily) to make things easier? |
I don't think I have the authority to change that. I think we'd need a |
Co-authored-by: David Feuer <[email protected]>
Yes, getting it to run with MHS is mostly a matter of #ifdef-ing out things that base does not support (and cannot support right now, since it needs extensions like QualifiedConstraints). |
Would it make sense on MicroHs to have a local copyish of |
I've added CI for MHS. It's a little clunky right now, but I hope to improve it. |
I'll add Control.Category and update the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If QuantifiedConstraints is a problem, MicroHs could define the pre-QuantifiedConstraints versions of the classes (Eq1, Ord1, Bifoldable, etc). This would let us get rid of most of the CPP.
Just for your amusement: containers has 25kloc of Haskell code and MHS has 11kloc. :) |
I'm making the MHS base library more GHC compatible. The PR will be updated soon. |
Don't compromise your principles too much, but the less CPP we have to deal with the better. |
I've made my changes. Please have a look again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, this is looking much nicer!
- name: checkout mhs repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: augustss/MicroHs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this check out a particular version?
We wouldn't want containers CI to break in there is an issue with MHS head.
We can update the version periodically, as we do for GHC.
import Language.Haskell.TH.Syntax (Lift) | ||
-- See Note [ Template Haskell Dependencies ] | ||
import Language.Haskell.TH () | ||
#endif | ||
import Text.Read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use #if defined(__GLASGOW_HASKELL__) || defined(__MHS__)
for this, to reflect the Read instance.
import Data.Coerce | ||
#endif | ||
|
||
import Text.Read hiding (lift) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
import Data.Coerce | ||
import qualified GHC.Exts | ||
#else | ||
import qualified Data.List | ||
#endif | ||
|
||
-- Array stuff, with GHC.Arr on GHC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can import qualified GHC.Arr
be moved back, to keep this comment valid?
import Data.Coerce | ||
import qualified GHC.Exts | ||
#else | ||
import qualified Data.List |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this import used somewhere?
@@ -233,7 +234,7 @@ instance Foldable Tree where | |||
product = foldlMap1' id (*) | |||
{-# INLINABLE product #-} | |||
|
|||
#if MIN_VERSION_base(4,18,0) | |||
#if MIN_VERSION_base(4,18,0) && (defined(__GLASGOW_HASKELL__) || defined(__MHS__)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can drop the compiler checks here. Let's assume Foldable1 will be around, or we'd be doing the same for Eq1, Ord1, etc.
-- | This hideous module lets us avoid dealing with the fact that | ||
-- @liftA2@ and @foldl'@ were not previously exported from the standard prelude. | ||
module Utils.Containers.Internal.Prelude | ||
( module Prelude | ||
, Applicative (..) | ||
, Foldable (..) | ||
#ifdef __MHS__ | ||
, Traversable(..) | ||
, NonEmpty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NonEmpty seems a little odd, is it required?
@@ -2112,6 +2114,7 @@ mergeA | |||
EQL -> binA p1 (go l1 l2) (go r1 r2) | |||
NOM -> linkA (unPrefix p1) (g1t t1) (unPrefix p2) (g2t t2) | |||
|
|||
subsingletonBy :: Functor f => (Key -> a -> f (Maybe c)) -> Key -> a -> f (IntMap c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the signature required for MHS?
Mostly #ifdefs and some type signatures.