| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Serialize.Descriptor
Synopsis
- newtype Descriptor s a = Descriptor (Get a, s -> Put)
- unwrapGet :: Descriptor s a -> Get a
- unwrapPut :: s -> Descriptor s a -> Put
- serialize :: s -> Descriptor s a -> ByteString
- deserialize :: ByteString -> Descriptor s s -> Either String s
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
| Functor (Descriptor s) Source # | |
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 # | |
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 -> Put 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'