[Haskell-cafe] fmap vs. liftM
Dan Weston
westondan at imageworks.com
Tue Feb 5 15:06:42 EST 2008
Can you do this with a GHC rule? Something like:
{-# RULES
"join_dot_fmap_return/id" forall x . join (fmap return x) = x
#-}
Dan
Henning Thielemann wrote:
> On Tue, 5 Feb 2008, Brandon S. Allbery KF8NH wrote:
>
>> On Feb 5, 2008, at 8:31 , Henning Thielemann wrote:
>>
>>> How do you convince the compiler that
>>> 'join (fmap return x) == x' ?
>> How do you convince it that the current formulation of Monad obeys
>> the monad laws? (rhetorical)
>
> My point was that the constraint 'liftM == fmap' cannot be expressed in
> Haskell 98, and the answer by Miguel suggested that it would be possible
> by a different design of class Monad. The above was my objection to this
> suggestion.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
More information about the Haskell-Cafe
mailing list