ribosome-host-0.9.9.9: Neovim plugin host for Polysemy
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ribosome.Host.Class.Msgpack.Map

Description

Helper for encoding values to a heterogeneous MessagePack map.

Synopsis

Documentation

class MsgpackMapElem a where Source #

Utility class for MsgpackMap.

Instances

Instances details
(MsgpackEncode a, t ~ Text) => MsgpackMapElem (t, Maybe a) Source # 
Instance details

Defined in Ribosome.Host.Class.Msgpack.Map

Methods

msgpackMapElem :: (t, Maybe a) -> Map Text Object Source #

(MsgpackEncode a, t ~ Text) => MsgpackMapElem (t, a) Source # 
Instance details

Defined in Ribosome.Host.Class.Msgpack.Map

Methods

msgpackMapElem :: (t, a) -> Map Text Object Source #

class MsgpackMap a where Source #

This class provides a variadic method for encoding MessagePack maps.

Methods

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

Instances details
MsgpackMap (Map Text Object -> Object) Source # 
Instance details

Defined in Ribosome.Host.Class.Msgpack.Map

(MsgpackMapElem (t, a), MsgpackMap (Map Text Object -> b)) => MsgpackMap (Map Text Object -> (t, a) -> b) Source # 
Instance details

Defined in Ribosome.Host.Class.Msgpack.Map

Methods

msgpackMap :: Map Text Object -> (t, a) -> b Source #

(MsgpackMapElem (t, a), MsgpackMap (Map Text Object -> b)) => MsgpackMap ((t, a) -> b) Source # 
Instance details

Defined in Ribosome.Host.Class.Msgpack.Map

Methods

msgpackMap :: (t, a) -> b Source #

MsgpackMap (a -> a) Source # 
Instance details

Defined in Ribosome.Host.Class.Msgpack.Map

Methods

msgpackMap :: a -> a Source #