
4 Jan
2011
4 Jan
'11
10:51 a.m.
On January 4, 2011 07:25:36 Ian Lynagh wrote:
Have you got an example of a Monad for which you'd want to define join but not (>>=)?
(>>) :: forall a b. m a -> m b -> m b (>>) = (*>)
return :: a -> m a return = pure
fail :: String -> m a fail s = error s
2) Make 'join' a method of Monad.
Why?
It seems to me that while join is more of a value transformer as apposed to a flow combining operator, which makes it fit in better with the rest applicative. That is, (<*>) :: f (a -> b) -> f a -> f b -- (<*>) f -- transforms f join :: f (f a) -> f a -- join y -- transforms y return :: a -> f a -- return x -- transforms x Cheers! -Tyson