λ> data D = D { foo :: Int, bar :: String } deriving (Show, Generic)
λ> instance Serialize D
λ> encode $ D 666 "лох"
"\NUL\NUL\NUL\NUL\NUL\NUL\STX\154\NUL\NUL\NUL\NUL\NUL\NUL\NUL\ETX\208\187\208\190\209\133"
λ> (decode $ encode $ D 666 "лох") :: Either String D
Right (D {foo = 666, bar = "лох"})