what difference between return
, pure
control.applicative
? seems can use pure
@ end of do
block?
so there situation 1 should preferred on other (besides expects return
@ end of do
block)?
in ghc 7.8 , before, applicative
not superclass of monad
. possible monad
instance not have applicative
instance. there was, however, expectation pure
, return
should have same behavior types instances of both.
in ghc 7.10, due functor-applicative-monad proposal, applicative
superclass of monad
(class applicative m => monad m
) , rule pure
, return
must same monad
instances. in fact, default implementation of return
pure
, seen in the source on hackage.
pure
might preferred return
because not incur monad
constraint, applicative
constraint, making function more general. return
might preferred pure
in notation because of historical precedent, pure
used same effect.
Comments
Post a Comment