On Tue, Jan 30, 2007 at 10:22:58AM +0000, Duncan Coutts wrote: > I was about to say that for the more complicated binary serialisation > formats (eg GHC's .hi format) people need monads with state, like string > pools etc, but actually now that I think about it, that can be done with > a monoid too. > > Ross, you need to make a monoid transformer library (at least reader and > state) and campaign for ++ to be redefined as mappend, then everyone > will want to use it since it'll be so neat and convenient! :-) > > Can anyone see a real serialisation use case that needs a monad for the > serialisation side? I'd thought I had an example, but I was wrong.
If you really want a monad, you can put the monoid into the writer monad - and that's exactly what is done in Data.Binary! However, for someone who prefers the monadic interface, wrapping in the writer monad every time and additional boilerplate code (tell) can be a nuisance. Best regards Tomasz _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe