Proposal: Applicative => Monad: Call for consensus
Tyson Whitehead
twhitehead at gmail.com
Tue Jan 4 16:51:01 CET 2011
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
More information about the Libraries
mailing list