NB: DO NOT USE `pure = return`

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

NB: DO NOT USE `pure = return`

Johannes Waldmann-2
Dear Cafe,

the migration guide (for AMP)

https://gitlab.haskell.org/ghc/ghc/wikis/migration/7.10#ghc-says-no-instance-for-applicative-

contains this advice:

instance Applicative Foo where
    -- NB: DO NOT USE `pure = return`

Why not? Because it would require another refactoring
once "monad of no return" comes true?

So defining `return` in the Monad instance should work fine until then?
Which is when exactly? I can't quite make it out from
https://gitlab.haskell.org/ghc/ghc/wikis/proposal/monad-of-no-return/discussion


- J.W.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: NB: DO NOT USE `pure = return`

Brandon Allbery
Most likely because MonadOfNoReturn will transitionally define return = pure, and instead of a compile error error you would end up with runtime infinite loops.

On Mon, Jul 1, 2019 at 3:09 PM Johannes Waldmann <[hidden email]> wrote:
Dear Cafe,

the migration guide (for AMP)

https://gitlab.haskell.org/ghc/ghc/wikis/migration/7.10#ghc-says-no-instance-for-applicative-

contains this advice:

instance Applicative Foo where
    -- NB: DO NOT USE `pure = return`

Why not? Because it would require another refactoring
once "monad of no return" comes true?

So defining `return` in the Monad instance should work fine until then?
Which is when exactly? I can't quite make it out from
https://gitlab.haskell.org/ghc/ghc/wikis/proposal/monad-of-no-return/discussion


- J.W.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.


--
brandon s allbery kf8nh

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.