[Haskell-cafe] What's the advantage of writing Haskell this way?
malcolm.wallace at me.com
Tue May 31 07:54:16 CEST 2011
instance (Monad m, MonadPlus m) => Monoid (Stream m a) where
> mempty = Chunks mempty
> mappend (Chunks xs) (Chunks ys) = Chunks (xs `mappend` ys)
> mappend _ _ = EOF
> No instance for (Monoid (m a))
> arising from a use of `mempty'
There is a clue in the first part of the error message. Add the required instance as part of the predicate:
instance (Monad m, MonadPlus m, Monoid (m a)) => Monoid (Stream m a) where ...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe