[Haskell-cafe] serialize an unknown type

Stephen Tetley stephen.tetley at gmail.com
Wed Oct 24 19:25:37 CEST 2012

Hi Corentin

It looks like you are writing the event handler on the server side. If
so, the range of events you can handle is fixed to just those you
implement handlers for - having an openly extensible event type is
useless if this is the case.

Ignoring client/server for a moment, a function (State -> State) would
be the most "extensible" API you could allow for clients. You don't
need to worry about an open set of Event types, a client knows the
state exactly and doesn't need extensibility.

Client/Server operation won't allow a state transformer API as Haskell
can't readily serialize functions. But you can implement a "command
language" enumerating state changing operations. The second Quickcheck
paper gives a very good example of how to implement such a command

Testing Monadic Code with QuickCheck (2002)
Koen Claessen , John Hughes

Or Citeseer if you need a PDF:

More information about the Haskell-Cafe mailing list