mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-22 08:02:08 +02:00
haskell: Now, Object is an instance of NFData.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user