[Haskell-beginners] Return function

Shishir Srivastava shishir.srivastava at gmail.com
Tue Apr 21 11:16:47 UTC 2015


Hi,

Looking at the definition of return function for a Monad, it is described
as -

return :: a -> m a

However when I do -

return (Just 3)

The result is

Just 3

and not

Just (Just 3)

If I understand the definition correctly (which doesn't seem to be the
case) the return function should wrap the parameter (which in my case is
'Just 3') into the Maybe Monad and therefore should return me 'Just (Just
3)'

Please can someone help explain.

Thanks,

Shishir Srivastava
 +44 (0) 750 127 5019
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150421/9a57f6fc/attachment.html>


More information about the Beginners mailing list