summaryrefslogtreecommitdiff
path: root/haskell/src/Data/MessagePack/Object.hs
diff options
context:
space:
mode:
authortanakh <tanaka.hideyuki@gmail.com>2010-09-07 16:14:29 +0900
committertanakh <tanaka.hideyuki@gmail.com>2010-09-07 16:14:29 +0900
commit169f287970a68e52d766b485f9c870ef83916b59 (patch)
treeb389979a55d49859a861a49cae7874bd27e3069a /haskell/src/Data/MessagePack/Object.hs
parentc56926428c2b66fd3f112b9095c46f46e0527cd7 (diff)
downloadmsgpack-python-169f287970a68e52d766b485f9c870ef83916b59.tar.gz
haskell: Now, Object is an instance of NFData.
Diffstat (limited to 'haskell/src/Data/MessagePack/Object.hs')
-rw-r--r--haskell/src/Data/MessagePack/Object.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/haskell/src/Data/MessagePack/Object.hs b/haskell/src/Data/MessagePack/Object.hs
index df0e89d..6806722 100644
--- a/haskell/src/Data/MessagePack/Object.hs
+++ b/haskell/src/Data/MessagePack/Object.hs
@@ -25,6 +25,7 @@ module Data.MessagePack.Object(
Result,
) where
+import Control.DeepSeq
import Control.Monad
import Control.Monad.Trans.Error ()
import qualified Data.ByteString as B
@@ -41,6 +42,17 @@ data Object =
| ObjectMap [(Object, Object)]
deriving (Show)
+instance NFData Object where
+ rnf obj =
+ case obj of
+ ObjectNil -> ()
+ ObjectBool b -> rnf b
+ ObjectInteger n -> rnf n
+ ObjectDouble d -> rnf d
+ ObjectRAW bs -> bs `seq` ()
+ ObjectArray a -> rnf a
+ ObjectMap m -> rnf m
+
-- | The class of types serializable to and from MessagePack object
class OBJECT a where
-- | Encode a value to MessagePack object