
On Tue, 2007-01-30 at 09:38 +0000, Ross Paterson wrote:
On Tue, Jan 30, 2007 at 09:52:01AM +1100, Donald Bruce Stewart wrote:
ross:
why do you need a Put monad, which always seems to have the argument type ()? Monoids really are underappreciated.
For the syntax, and So that people can directly port their code from NewBinary. (The instances are basically unchanged).
And so the successor to binary must have the same interface, and so on forever. The backward compatibility argument seems weak to me, leaving only the advantage of do-notation.
Monads are the new lists.
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. Duncan