mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-23 00:08:01 +02:00
haskell: TH support and refactoring
This commit is contained in:
19
haskell/test/UserData.hs
Normal file
19
haskell/test/UserData.hs
Normal file
@@ -0,0 +1,19 @@
|
||||
{-# Language TemplateHaskell #-}
|
||||
|
||||
import Data.MessagePack
|
||||
import Data.MessagePack.Derive
|
||||
|
||||
data T
|
||||
= A Int String
|
||||
| B Double
|
||||
deriving (Show)
|
||||
|
||||
$(deriveObject ''T)
|
||||
|
||||
main = do
|
||||
let bs = pack $ A 123 "hoge"
|
||||
print bs
|
||||
print (unpack bs :: T)
|
||||
let cs = pack $ B 3.14
|
||||
print cs
|
||||
print (unpack cs :: T)
|
Reference in New Issue
Block a user