lighthouse-client-0.2.0.0: Project Lighthouse client SDK
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lighthouse.Utils.MessagePack

Synopsis

Convenience functions for construction

mpStr :: Text -> Object Source #

Creates a MessagePack string.

mpInt :: Int -> Object Source #

Creates a MessagePack integer.

mpBool :: Bool -> Object Source #

Creates a MessagePack boolean.

mpMap :: [(Text, Object)] -> Object Source #

Creates a MessagePack map.

mpArray :: [Object] -> Object Source #

Creates a MessagePack array.

mpBin :: ByteString -> Object Source #

Creates a MessagePack binary.

mpNil :: Object Source #

Creates a MessagePack nil.

Convenience functions for deconstruction

mpUnStr :: Object -> Either Text Text Source #

Deconstructs a MessagePack string.

mpUnInt :: Object -> Either Text Int Source #

Deconstructs a MessagePack integer.

mpUnBool :: Object -> Either Text Bool Source #

Deconstructs a MessagePack boolean.

mpUnArray :: Object -> Either Text [Object] Source #

Deconstructs a MessagePack array.

mpUnMap :: Object -> Either Text [(Object, Object)] Source #

Deconstructs a MessagePack map.

mpLookup :: Text -> [(Object, Object)] -> Either Text Object Source #

Looks up a key in a deconstructed MessagePack map.

Conversions to and from MessagePack

class MPSerializable a where Source #

Methods

mpSerialize :: a -> Object Source #

Converts to a MessagePack representation.

Instances

Instances details
MPSerializable Display Source # 
Instance details

Defined in Lighthouse.Protocol

Methods

mpSerialize :: Display -> Object Source #

MPSerializable ClientMessage Source # 
Instance details

Defined in Lighthouse.Protocol

Methods

mpSerialize :: ClientMessage -> Object Source #

MPSerializable Object Source # 
Instance details

Defined in Lighthouse.Utils.MessagePack

Methods

mpSerialize :: Object -> Object Source #

class MPDeserializable a where Source #

Methods

mpDeserialize :: Object -> Either Text a Source #

Converts from a MessagePack representation.

Instances

Instances details
MPDeserializable InputEvent Source # 
Instance details

Defined in Lighthouse.Protocol

MPDeserializable ServerMessage Source # 
Instance details

Defined in Lighthouse.Protocol

MPDeserializable Object Source # 
Instance details

Defined in Lighthouse.Utils.MessagePack

Methods

mpDeserialize :: Object -> Either Text Object Source #

MPDeserializable () Source # 
Instance details

Defined in Lighthouse.Utils.MessagePack

Methods

mpDeserialize :: Object -> Either Text () Source #

MPDeserializable a => MPDeserializable [a] Source # 
Instance details

Defined in Lighthouse.Utils.MessagePack

Methods

mpDeserialize :: Object -> Either Text [a] Source #