Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Helper for encoding values to a heterogeneous MessagePack map.
Synopsis
- class MsgpackMapElem a where
- msgpackMapElem :: a -> Map Text Object
- class MsgpackMap a where
- msgpackMap :: a
Documentation
class MsgpackMapElem a where Source #
Utility class for MsgpackMap
.
Instances
(MsgpackEncode a, t ~ Text) => MsgpackMapElem (t, Maybe a) Source # | |
Defined in Ribosome.Host.Class.Msgpack.Map | |
(MsgpackEncode a, t ~ Text) => MsgpackMapElem (t, a) Source # | |
Defined in Ribosome.Host.Class.Msgpack.Map |
class MsgpackMap a where Source #
This class provides a variadic method for encoding MessagePack maps.
msgpackMap :: a Source #
Encode an arbitrary number of heterogeneously typed values to a single MessagePack map. This function is variadic, meaning that it takes an arbitrary number of arguments:
>>>
msgpackMap ("number", 5 :: Int) ("status", "error" :: Text) ("intensity", 3.14 :: Double) :: Object
ObjectMap (Map.fromList [(ObjectString "number", ObjectInt 5), (ObjectString "status", ObjectString "error"), (ObjectString "intensity", ObjectFloat 3.14)])
This avoids the need to call toMsgpack
once for each element and then once more for the map.
Instances
MsgpackMap (Map Text Object -> Object) Source # | |
Defined in Ribosome.Host.Class.Msgpack.Map | |
(MsgpackMapElem (t, a), MsgpackMap (Map Text Object -> b)) => MsgpackMap (Map Text Object -> (t, a) -> b) Source # | |
Defined in Ribosome.Host.Class.Msgpack.Map | |
(MsgpackMapElem (t, a), MsgpackMap (Map Text Object -> b)) => MsgpackMap ((t, a) -> b) Source # | |
Defined in Ribosome.Host.Class.Msgpack.Map msgpackMap :: (t, a) -> b Source # | |
MsgpackMap (a -> a) Source # | |
Defined in Ribosome.Host.Class.Msgpack.Map msgpackMap :: a -> a Source # |