[Haskell-cafe] Inverting a Monad

Miguel Mitrofanov miguelimo38 at yandex.ru
Wed Feb 6 06:39:16 EST 2008


> invM :: Maybe a -> Maybe ()
> invM Nothing  = Just ()
> invM (Just _) = Nothing
>
> invL :: [] a -> [] ()
> invL []    = [()]
> invL (_:_) = []
>
>
> How can I define this for an arbitrary Monad m?

Such as Identity?


More information about the Haskell-Cafe mailing list