On Wed, May 16, 2007 at 09:28:31AM +0100, Jules Bean wrote: > Tomasz Zielonka wrote: > >You mean using the (Monoid b) => Monoid (a -> b) instance ? > >I can see that IO () makes a perfect Monoid, but there doesn't seem to > >be a standard instance for that. > > Indeed, all Monads are Monoids (that is, if m :: * -> * is a Monad, then > m a :: * is a Monoid, for any fixed type a) by using >>.
Are you sure that (IO Int) is a monoid with mappend = (>>)? How do you define mempty, so it is an identity for mappend? It would help if type a was a Monoid, then: mempty = return mempty mappend mx my = do x <- mx y <- my return (x `mappend` y) It's easier if a = (). Regards Tomek _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe