Flexible serialization with MultiParamTypeClasses
问题 I'm playing around with an idea for an extensible serialization library. I have the following typeclass: class Monoid m => BuilderS m a where cstr :: String -> a -> m The idea is that people can define instances for pairs of different serializers/types, like this: import qualified Data.Serialize.Builder as B instance Serialize a => BuilderS B.Builder a where cstr _ = B.fromByteString . encode And a usage example: sfPut :: (BuilderS a b, Monoid a) => WriterT a Identity () sfPut = do tell $