[Haskell-cafe] Stacked return
Dmitry Bogatov
KAction at gnu.org
Sat Nov 23 17:30:23 UTC 2013
> Perhaps you just want monad transformers [1, 2]. If you're not familiar
> with them, you should probably read [3].
>
> With transformers you'd be able to do this (and more):
>
> $ return 2 :: IO Int
> $ return 2 :: ListT Maybe Int -- this works like Maybe [Int]
> $ return 2 :: MaybeT [] Int -- this works like [Maybe Int]
In fact, I read and used transformers a bit. If I understand correctly,
I can only do such things for monads, supported by transformers. So,
I cant get (return 2) :: MyWierdMonad (MyAnotherMonad 2)
Yes, I know, it have little practical use, but I am insterested about
teoretical part of question, magic of ghc.
--
Best regards, Dmitry Bogatov <KAction at gnu.org>,
Free Software supporter and netiquette guardian.
git clone git://kaction.name/rc-files.git --depth 1
GPG: 54B7F00D
Html mail and proprietary format attachments are forwarded to /dev/null.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131123/64629459/attachment.sig>
More information about the Haskell-Cafe
mailing list