On Feb 6, 2008 12:39 PM, Miguel Mitrofanov <[EMAIL PROTECTED]> wrote:
> > 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?
>
Well in:
inv :: (Monad m, ...) => m a -> m ()
inv m = ...
I don't mind that there are more constraints on 'm' than just Monad
maybe a MonadPlus constraint or others are needed.
(I was even thinking about a MonadTimes class as in:
class MonadPlus m => MonadTimes m where
mone :: m ()
mtimes :: m a -> m a -> m a
)
Thanks,
Bas
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe