[Haskell-cafe] Are all monads functions?

Steve Horne sh006d3592 at blueyonder.co.uk
Sat Dec 31 20:26:57 CET 2011


On 31/12/2011 13:18, Yves Parès wrote:
> But still, I maintain my previous view. I could clarify that by saying 
> that (e.g. for Maybe) we could separate it in two types, Maybe itself 
> and its monad:
>
> -- The plain Maybe type
> data Maybe a = Just a | Nothing
>
> -- The MaybeMonad
> newtype MaybeMonad a = MM ( () -> Maybe a )
>
You've just reminded me of a painful time - lot's a scratching my head 
and saying "but these parser functions are monadic - the tutorial 
clearly says they're monadic - why does my every attempt at making the 
type an instance of Monad fail?"

Answer - I only had the equivalent of the Maybe type, and I was trying 
to force it where the MaybeMonad should go.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111231/9cad3825/attachment.htm>


More information about the Haskell-Cafe mailing list