msgpack / msgpack-haskell

Haskell implementation of MessagePack / msgpack.org[Haskell]
http://hackage.haskell.org/package/msgpack
138 stars 80 forks source link

Problem unpacking ADTs #38

Closed leonbaum closed 5 years ago

leonbaum commented 11 years ago

I am new to Haskell, so perhaps I am mistaken in expecting the following to work, but it seems to me that MessagePack should be able to serialize any ADT.

{-# LANGUAGE TemplateHaskell #-}
import Data.MessagePack

data Test = X | Y | Z Int deriving Show
deriveObject True ''Test

main = do
  print ((unpack . pack) X :: Test)  -- "X" as expected
  print ((unpack . pack) Y :: Test)  -- "X", but expected "Y"
  print ((unpack . pack) $ Z 3 :: Test) -- "Z 3" as expected
  print $ pack X
  print $ pack Y
  print $ pack $ Z 3
sbeschke commented 10 years ago

I can confirm this bug. EDIT: I fixed it, see my pull request #43.

hvr commented 5 years ago

Support for TH-based derivation was removed with the msgpack-1.0.0 rls