describe-0.1.1.0: Combinators for describing binary data structures

Safe HaskellNone
LanguageHaskell2010

Data.Serialize.Descriptor

Synopsis

Documentation

newtype Descriptor s a Source #

Descriptor s a is an applicative functor that describes the binary structure for a structure s while deserializing value a.

Constructors

Descriptor (Get a, s -> Put) 
Instances
Monad (Descriptor s) Source # 
Instance details

Defined in Data.Serialize.Descriptor

Methods

(>>=) :: Descriptor s a -> (a -> Descriptor s b) -> Descriptor s b #

(>>) :: Descriptor s a -> Descriptor s b -> Descriptor s b #

return :: a -> Descriptor s a #

fail :: String -> Descriptor s a #

Functor (Descriptor s) Source # 
Instance details

Defined in Data.Serialize.Descriptor

Methods

fmap :: (a -> b) -> Descriptor s a -> Descriptor s b #

(<$) :: a -> Descriptor s b -> Descriptor s a #

Applicative (Descriptor s) Source # 
Instance details

Defined in Data.Serialize.Descriptor

Methods

pure :: a -> Descriptor s a #

(<*>) :: Descriptor s (a -> b) -> Descriptor s a -> Descriptor s b #

liftA2 :: (a -> b -> c) -> Descriptor s a -> Descriptor s b -> Descriptor s c #

(*>) :: Descriptor s a -> Descriptor s b -> Descriptor s b #

(<*) :: Descriptor s a -> Descriptor s b -> Descriptor s a #

unwrapGet :: Descriptor s a -> Get a Source #

unwrapGet desc takes a Descriptor and returns only the internal Get monad.

unwrapPut :: s -> Descriptor s a -> PutM () Source #

unwrapPut s desc takes the structure being described and a Descriptor for it, and returns the internal Put monad.

serialize :: s -> Descriptor s a -> ByteString Source #

Convenience function for runPut . unwrapPut s

deserialize :: ByteString -> Descriptor s s -> Either String s Source #

Convenience function for flip runGet bs . unwrapGet