Monad of no `return` Proposal (MRP): Moving `return` out of `Monad`

Mario Blažević blamario at
Fri Sep 25 01:25:09 UTC 2015

     A conditional +1 from me, the condition being to allow the same 
monad instance code to compile at least with GHC versions 7.8, 7.10, and 
8.0 without any CPP directives. I think that can be accomplished by an 
extra clarification that the meaning of "override" in

> **Phase 1** *(GHC 8.0)*: Implement new warning in GHC which gets
>     triggered when `Monad` instances explicitly override the
>     default `return` method implementation.

does *not* include a re-definition of

    return = pure

     Yes, I realize this corner case would be a wart in the next 
language standard. We could fix that by disabling even this 
re-definition in case {#- LANGUAGE Haskell2020 #-} or equivalent is 
declared. Perhaps there should be two pragmas, {#- LANGUAGE Haskell2020+ 
#-} and {#- LANGUAGE Haskell2010-2020 #-}?

More information about the Libraries mailing list