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

Support mtl-2.3-rc4 #5659

Closed
3 of 4 tasks
Tracked by #5831
andreasabel opened this issue Nov 19, 2021 · 11 comments · Fixed by #5772
Closed
3 of 4 tasks
Tracked by #5831

Support mtl-2.3-rc4 #5659

andreasabel opened this issue Nov 19, 2021 · 11 comments · Fixed by #5772
Assignees
Labels
hackage Agda's Haskell dependencies and its presence on Hackage stackage
Milestone

Comments

@andreasabel
Copy link
Member

andreasabel commented Nov 19, 2021

Dependencies breaking with mtl-2.3:

Problems in our code:

  • transformers-0.6, enabled by mtl-2.3 breaks compilation of instance MonadTrans TCMT.

Context:

Release of mtl-2.3 is imminent, see

Announcement mail by Emily Pillmore

Chessai and I are excited to announce a release candidate for mtl: mtl-2.3-rc3!

Timeline

The timeline for release will be as follows:

  • This announcement marks the start of the timeline

  • We will give 2 weeks of testing before considering release

  • If no major issues are filed before then, mtl-2.3-rc3 will be released as mtl-2.3, and if issues are found, they will be amended, and a new release candidate will be announced, resetting the 2 week period.

To test mtl-2.3-rc3 for yourself, please feel free to add the following to your cabal.project:

source-repository-package
  type: git
  location: https://github.com/haskell/mtl.git
  tag: 5d0f62b8007bb96e49f36a5544741cfe96a97130

or, if you're a stack user add this entry to your extra-deps:

- git: https://github.com/haskell/mtl.git
  commit: 5d0f62b8007bb96e49f36a5544741cfe96a97130

And make sure to adjust all bounds/allow-newer accordingly. Please note that this release of mtl is a full major version release, and will be the last of the 2.x series before work begins on updating the mtl class hierarchy.

Changelog

  • Add instances for Control.Monad.Trans.Writer.CPS and Control.Monad.Trans.RWS.CPS from transformers 0.5.6 and add Control.Monad.Writer.CPS and Control.Monad.RWS.CPS.

  • Control.Monad.Cont now re-exports evalCont and evalContT

  • Add tryError, withError, handleError, and mapError to

Control.Monad.Error.Class, and re-export from Control.Monad.Except.

  • Remove Control.Monad.List and Control.Monad.Error

  • Remove instances of deprecated ListT and ErrorT

  • Remove re-exports of Error

  • Add instances for Control.Monad.Trans.Accum and Control.Monad.Trans.Select ( http://control.monad.trans.select/ )

  • Remove re-exports of Control.Monad, Control.Monad.Fix and Data.Monoid modules

I'd like to thank the many contributors who offered patches, tickets, and other help in the preparation of this release. We appreciate all of your help!

Happy hacking!

Emily

@andreasabel andreasabel added the hackage Agda's Haskell dependencies and its presence on Hackage label Nov 19, 2021
@andreasabel andreasabel modified the milestones: 2.6.2.1, 2.6.2.2 Nov 19, 2021
@andreasabel
Copy link
Member Author

If mtl-2.3 is released as planned it will break all of hackage.

Because of this, there could be delays. Esp. stackage nightly might not switch so quickly. Thus, I removed this from the 2.6.2.1 milestone.

@andreasabel
Copy link
Member Author

andreasabel commented Jan 28, 2022

The new RC4 breaks very little, but the removal of ErrorT will still affect us.
(EDIT: Rather, our dependencies.)

@andreasabel
Copy link
Member Author

andreasabel commented Feb 1, 2022

Seems we are hit by the following innovation in transformers-0.6:

0.6.0.0 Ross Paterson R.Paterson@city.ac.uk Jul 2021

  • Added quantified constraint to MonadTrans (for GHC >= 8.6)
class (forall m. Monad m => Monad (t m)) => MonadTrans t where

Problem here:

instance MonadTrans TCMT where
lift m = TCM $ \_ _ -> m
-- We want a special monad implementation of fail.
instance MonadIO m => Monad (TCMT m) where
return = pure
(>>=) = bindTCMT
(>>) = (*>)
#if __GLASGOW_HASKELL__ < 808
fail = Fail.fail
#endif
instance MonadIO m => Fail.MonadFail (TCMT m) where
fail = internalError

src/full/Agda/TypeChecking/Monad/Base.hs:4263:10: error:
    • Could not deduce (MonadIO m)
        arising from the superclasses of an instance declaration
      from the context: Monad m
        bound by a quantified context
        at src/full/Agda/TypeChecking/Monad/Base.hs:1:1
      Possible fix:
        add (MonadIO m) to the context of a quantified context
    • In the instance declaration for ‘MonadTrans TCMT’

Reported this problem upstream:

andreasabel added a commit that referenced this issue Feb 2, 2022
…Applicative

The new constraints are more precise and will help with migration to
transformers-0.6.
@andreasabel
Copy link
Member Author

According to my experience so far, Agda 2.6.2.1 could be relaxed to mtl < 2.4 if restricted to transformers < 0.6 (the latter is implicit in mtl < 2.3). Let's do this revision once mtl-2.3 is out.

@andreasabel andreasabel self-assigned this Feb 2, 2022
@RossPaterson
Copy link

RossPaterson commented Feb 2, 2022

Would this be fixed if agda changes the instance to

#if __GLASGOW_HASKELL__ < 808
instance MonadIO m => Monad (TCMT m) where
#else
instance Monad m => Monad (TCMT m) where
#endif
    return = pure
    (>>=)  = bindTCMT
    (>>)   = (*>)
#if __GLASGOW_HASKELL__ < 808
    fail   = Fail.fail
#endif

and transformers limits the constraint to GHC >= 8.8?

@andreasabel
Copy link
Member Author

@RossPaterson : Thanks for engaging! I will investigate your suggestion and get back to you.

@andreasabel
Copy link
Member Author

@RossPaterson : Indeed, your fix simply works for all our GHC versions!, except for GHC 8.6.
(I was afraid the choice of superclass constraint of Monad (TCMT m) would affect more locations, but its really just that bit now (after my previous AMP-refactoring).)

So your suggested revision of transformers-0.6.0 would work for us.

@RossPaterson
Copy link

Glad to hear it. The change is in transformers-0.6.0.3.

andreasabel added a commit that referenced this issue Feb 2, 2022
…Applicative

The new constraints are more precise and will help with migration to
transformers-0.6.
andreasabel added a commit that referenced this issue Feb 3, 2022
@andreasabel
Copy link
Member Author

andreasabel commented Feb 7, 2022

Revision 3 of 2.6.2.1 to allow mtl-2.3 but restrict to transformers-0.5.*: https://hackage.haskell.org/package/Agda-2.6.2.1/revisions/

@andreasabel andreasabel changed the title Support mtl-2.3 Support mtl-2.3-rc4 Feb 24, 2022
@andreasabel andreasabel mentioned this issue Mar 14, 2022
41 tasks
andreasabel added a commit that referenced this issue Mar 15, 2022
…Applicative

The new constraints are more precise and will help with migration to
transformers-0.6.
andreasabel added a commit that referenced this issue Mar 15, 2022
andreasabel added a commit that referenced this issue Mar 16, 2022
…Applicative

The new constraints are more precise and will help with migration to
transformers-0.6.
@phadej
Copy link
Contributor

phadej commented Nov 23, 2022

I'm very late to the party, but GHC-8.6 already had MonadFailDesugaring, so defining fail in Monad instance wouldn't been strictly required. Having default-extensions: MonadFailDesugaring in Agda wouldn't needed to make breaking transformers release.

andreasabel added a commit that referenced this issue Nov 23, 2022
This was suggested by @phadej and it works thanks to
`MonadFailDesugaring` being on by default in GHC 8.6.
@andreasabel
Copy link
Member Author

@phadej: Thanks for pointing this out. Unfortunately, we didn't have the expertise to find the best solution back then. Indeed, I can simply relax the fix from GHC-8.8 to GHC-8.6 as the latter has MonadFailDesugaring on by default. I do not even need to add it to the Agda.cabal file (which would be a bit troublesome as it would have to be a default-extensions entry in a conditional).
I verified your suggestion in this PR:

andreasabel added a commit that referenced this issue Nov 24, 2022
This was suggested by @phadej and it works thanks to
`MonadFailDesugaring` being on by default in GHC 8.6.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hackage Agda's Haskell dependencies and its presence on Hackage stackage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants