Add voidM to Control.Monad

Erik Hesselink hesselink at gmail.com
Mon Jan 16 16:22:16 CET 2012


2012/1/16 Simon Hengel <sol at typeful.net>:
>> voidM :: Monad m => m a -> m ()
>> voidM m = m >> return ()
>
> Is voidM meant to be used with instance of Monad that are no monads, and
> hence have no Functor instance (like HtmlM[1])?

You could easily implement a Functor instance for this type, since it
would mirror the instance for `Const a` [2], i.e. only change the type
parameter, and otherwise be the identity function.

Erik

[1] http://hackage.haskell.org/packages/archive/blaze-html/0.4.3.1/doc/html/Text-Blaze-Internal.html#t:HtmlM
[2] http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Applicative.html#v:Const



More information about the Libraries mailing list