-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Build, traverse and deserialise packed data in Haskell @package packed-data @version 0.1.0.0 module Data.Packed.Needs -- | A buffer where packed values can be written The order to write these -- values is defined by the l type list -- -- If p is an empty list, then a value of type t can be -- extracted from that buffer. (See finish) newtype Needs (p :: [Type]) (t :: [Type]) Needs :: Builder -> Needs (p :: [Type]) (t :: [Type]) withEmptyNeeds :: forall (a :: [Type]) (b :: [Type]) (x :: [Type]) (y :: [Type]). NeedsBuilder a b x y -> Needs x y -- | Turns a Needs value (that does not expect to be written to) to -- a Packed finish :: forall (t :: [Type]). Needs ('[] :: [Type]) t -> Packed t -- | A wrapper around a function that builds a Needs -- -- ps: The type of the expected input of the source Needs -- -- ts: The type of the final packed data of the source -- Needs -- -- pd: The type of the expected input of the resuling -- Needs -- -- td: The type of the final packed data of the resulting -- Needs -- -- Note: It is an indexed monad. newtype NeedsBuilder (ps :: [Type]) (ts :: [Type]) (pd :: [Type]) (td :: [Type]) NeedsBuilder :: (Needs ps ts -> Needs pd td) -> NeedsBuilder (ps :: [Type]) (ts :: [Type]) (pd :: [Type]) (td :: [Type]) [runBuilder] :: NeedsBuilder (ps :: [Type]) (ts :: [Type]) (pd :: [Type]) (td :: [Type]) -> Needs ps ts -> Needs pd td -- | Shortcut type for NeedsBuilder's that simply write a value to a -- Needs without changing the final packed type type NeedsWriter a (r :: [Type]) (t :: [Type]) = NeedsBuilder a ': r t r t -- | Shortcut type for NeedsBuilder's that simply write multiple -- values to a Needs without changing the final packed type type NeedsWriter' (a :: [Type]) (r :: [Type]) (t :: [Type]) = NeedsBuilder a :++: r t r t (>>) :: forall (p1 :: [Type]) (t1 :: [Type]) (p2 :: [Type]) (t2 :: [Type]) (p3 :: [Type]) (t3 :: [Type]). NeedsBuilder p1 t1 p2 t2 -> NeedsBuilder p2 t2 p3 t3 -> NeedsBuilder p1 t1 p3 t3 mkNeedsBuilder :: forall (ps :: [Type]) (ts :: [Type]) (pd :: [Type]) (td :: [Type]). (Needs ps ts -> Needs pd td) -> NeedsBuilder ps ts pd td withNeeds :: forall (x :: [Type]) (y :: [Type]) (x1 :: [Type]) (y1 :: [Type]). Needs x y -> NeedsBuilder x y x1 y1 -> Needs x1 y1 concatNeeds :: forall (p :: [Type]) (t :: [Type]) (t1 :: [Type]). Needs p t -> NeedsBuilder ('[] :: [Type]) t1 p (t1 :++: t) applyNeeds :: forall (t1 :: [Type]) (r :: [Type]) (t :: [Type]). Needs ('[] :: [Type]) t1 -> NeedsBuilder (t1 :++: r) t r t unsafeCastNeeds :: forall (a :: [Type]) (b :: [Type]) (c :: [Type]) (d :: [Type]). Needs a b -> Needs c d -- | Type operator to concat lists of types type family (a :: [Type]) :++: (b :: [Type]) :: [Type] -- | It is recommended to import this module like so: -- --
--   import qualified Data.Packed.Reader as R
--   
module Data.Packed.Reader -- | Basically a function that reads/desrialises a value from a -- Packed -- -- p the types of the packed values to read -- -- r the packed type after the encoded values to read -- -- v the type of the value to unpack -- -- Note: It is an indexed monad. newtype PackedReader (p :: [Type]) (r :: [Type]) v PackedReader :: (ReaderPtr (p :++: r) -> Int -> IO (v, ReaderPtr r, Int)) -> PackedReader (p :: [Type]) (r :: [Type]) v [runPackedReader] :: PackedReader (p :: [Type]) (r :: [Type]) v -> ReaderPtr (p :++: r) -> Int -> IO (v, ReaderPtr r, Int) -- | Builds a PackedReader mkPackedReader :: forall (p :: [Type]) (r :: [Type]) v. (ReaderPtr (p :++: r) -> Int -> IO (v, ReaderPtr r, Int)) -> PackedReader p r v -- | Run the reading function using a ByteString. runReader :: forall (p :: [Type]) (r :: [Type]) v. PackedReader p r v -> Packed (p :++: r) -> IO (v, Packed r) -- | Allows bindings PackedReader together, in a monad-like manner. -- -- Similar to >>= (>>=) :: forall (p :: [Type]) (r1 :: [Type]) (r2 :: [Type]) v v'. PackedReader p (r1 :++: r2) v -> (v -> PackedReader r1 r2 v') -> PackedReader (p :++: r1) r2 v' -- | Similar to >> (>>) :: forall (p :: [Type]) (r1 :: [Type]) (r2 :: [Type]) v v'. PackedReader p (r1 :++: r2) v -> PackedReader r1 r2 v' -> PackedReader (p :++: r1) r2 v' -- | Allows reading another packed value in a do-notation. -- -- The reading of the second stream does not consume anything from the -- first. -- -- Example: -- --
--   import qualified Data.Packed.Reader as R
--   data Tree a = Leaf | Node (Tree a) a (Tree a)
--   
--   packedTreeToList :: PackedReader '[Tree Int] '[] [Int]
--   packedTreeToList = go []
--       where
--           go l =
--               caseTree
--                   (R.return l)
--                   ( R.do
--                       packedLeft <- isolate
--                       n <- readerWithFieldSize
--                       packedRight <- isolate
--                       -- Using lift allows consuming the packedRight value
--                       rightList <- R.lift (go l) packedRight
--                       R.lift (go $ n : rightList) packedLeft
--                   )
--   
lift :: forall (a :: [Type]) (b :: [Type]) v (r :: [Type]). PackedReader a b v -> Packed (a :++: b) -> PackedReader ('[] :: [Type]) r v fail :: forall (r :: [Type]) v. String -> PackedReader ('[] :: [Type]) r v -- | Like return, wraps a value in a PackedReader that will -- not consume its input. return :: forall v (r :: [Type]). v -> PackedReader ('[] :: [Type]) r v type ReaderPtr (r :: k) = Ptr Word8 -- | Util function that calls finish on the value produced by the -- input PackedReader finishReader :: forall (p :: [Type]) (r :: [Type]) (a :: [Type]). PackedReader p r (Needs ('[] :: [Type]) a) -> PackedReader p r (Packed a) instance GHC.Internal.Base.Functor (Data.Packed.Reader.PackedReader p r) module Data.Packed.Skippable class Skippable a skip :: forall (r :: [Type]). Skippable a => PackedReader '[a] r () -- | UNSAFE: Shifts the cursor to n bytes to the right. unsafeSkipN :: forall (a :: [Type]) (r :: [Type]). Int -> PackedReader a r () instance GHC.Internal.Foreign.Storable.Storable a => Data.Packed.Skippable.Skippable a -- | Module responsible for generating various functions to manipulate -- packed data. -- -- Note: For each example, consider that the code is generated for -- the following type: -- --
--   data Tree a = Leaf a | Node (Tree a) (Tree a)
--   
module Data.Packed.TH -- | Generate the following for the given type -- -- -- -- Example: -- --
--   $(mkPacked ''Tree [InsertFieldSize])
--   
mkPacked :: Name -> [PackingFlag] -> Q [Dec] -- | Options for the generation process. -- -- Beware: these options alter the signature and behaviour of the -- generated functions. data PackingFlag -- | When specified, each field in a packed data constructor will be -- preceded by a FieldSize, which indicates the size of the -- following packed value. -- -- Example -- -- As a consequence, for the following type, the caseTree -- function will have the following signature -- --
--   caseTree ::
--       (PackedReader (FieldSize ': a ': r) r b) ->
--       (PackedReader (FieldSize ': Tree a ': FieldSize ': Tree a ': r) r b) ->
--       PackedReader (Tree a ': r) r b
--   
InsertFieldSize :: PackingFlag -- | This flag should be used in complement to InsertFieldSize -- -- If set, no FieldSize will be inserted before the last parameter -- of the data constructor. -- -- Example -- -- If this flag is set (along with InsertFieldSize), for the -- following type, the caseTree function will have the following -- signature -- --
--   caseTree ::
--       (PackedReader (a ': r) r b) ->
--       (PackedReader (FieldSize ': Tree a ': Tree a ': r) r b) ->
--       PackedReader (Tree a ': r) r b
--   
SkipLastFieldSize :: PackingFlag -- | Generates a function to allow pattern matching a packed data type -- using the data constructors -- -- Example: -- -- For the Tree data type, it generates the following function: -- --
--   caseTree ::
--       (PackedReader '[a] r b) ->
--       (PackedReader '[Tree a, Tree a] r b) ->
--       PackedReader '[Tree a] r b
--   caseTree leafCase nodeCase = mkPackedReader $ packed l -> do
--      (tag :: Tag, packed1, l1) <- runReader reader packed l
--      case tag of
--          0 -> runReader leafCase packed1 l1
--          1 -> runReader nodeCase packed1 l1
--          _ -> fail "Bad Tag"
--   
genCase :: [PackingFlag] -> Name -> Q [Dec] -- | Generates an instance of Packable for the given type -- -- All the parameters of each constructor should be instances of -- Packable -- -- Note: The pack function simply calls the function generated by -- genWrite -- -- Example -- -- For the Tree data type, it generates the following instance: -- --
--   instance (Packable a) => Packable (Tree a) where
--       write = writeTree
--   
genPackableInstance :: [PackingFlag] -> Name -> Q [Dec] -- | Generates a function that serialises an applied data constructor -- -- The function calls the functions generated by genConWrite -- -- Example: -- -- For the Tree data type, it generates the following functions -- --
--   packLeaf :: (Packable a) => a -> Packed '[Tree a]
--   packLeaf n = finish (withEmptyNeeds (writeLeaf n))
--   
--   packNode :: (Packable a) => Tree a -> Tree a -> Packed '[Tree a]
--   packNode t1 t2 = finish (withEmptyNeeds (writeNode t1 t2))
--   
genConstructorPackers :: [PackingFlag] -> Name -> Q [Dec] -- | Generates a function that builds back data using already serialised -- fields -- -- Example: -- -- For the Tree data type, it generates the following functions -- --
--   repackLeaf :: Needs '[] a -> Needs '[] (Tree a)
--   repackLeaf pval = withEmptyNeeds (startLeaf N.>> concatNeeds pval)
--   
--   repackNode :: Needs '[] (Tree a) -> Needs '[] (Tree a) -> Needs '[] (Tree a)
--   repackNode lval rval = withEmptyNeeds (startNode N.>> concatNeeds lval N.>> concatNeeds rval)
--   
genConstructorRepackers :: [PackingFlag] -> Name -> Q [Dec] -- | Generates a function that serialises and writes a value into a -- Needs -- -- The function simply calls the functions generated by -- genConWrite -- -- Example: -- -- For the Tree data type, it generates the following function -- --
--   writeTree :: (Packable a) => Tree a -> NeedsWriter (Tree a) r t
--   writeTree (Leaf n) = writeConLeaf n
--   writeTree (Node l r) = writeConNode l r
--   
genWrite :: [PackingFlag] -> Name -> Q [Dec] -- | Generates a function that serialises and write a value to a -- Needs. The generated function is specific to a single data -- constructor. -- -- Example: -- -- For the Tree data type, it generates the following function -- for the Leaf constructor -- --
--   writeConLeaf :: (Packable a) => a -> 'NeedsWriter (Tree a) r t'
--   writeConLeaf n  = startLeaf >> write n
--   
genConWrite :: [PackingFlag] -> Name -> Tag -> [BangType] -> Q [Dec] -- | Generates a function that prepares a Needs to receive values -- from a data constructor. -- -- Example: -- -- For the Tree data type, it generates the following functions -- --
--   startLeaf :: NeedsBuilder (Tree a ': r) t (a ': r) t
--   startLeaf = mkNeedsBuilder (n -> runBuilder (write (0 :: Word8) (unsafeCastNeeds n)))
--   
--   startNode :: NeedsBuilder (Tree a ': r) t (Tree a ': Tree a ': r) t
--   startNode = mkNeedsBuilder (n -> runBuilder (write (1 :: Word8) (unsafeCastNeeds n)))
--   
genStart :: [PackingFlag] -> Name -> Tag -> [Type] -> Q [Dec] -- | Generates an instance of Unpackable for the given type -- -- All the parameters of each constructor should be instances of -- Unpackable -- -- Note: The unpack function simply calls the function generated by -- genRead -- -- Example -- -- For the Tree data type, it generates the following instance: -- --
--   instance (Unpackable a) => Unpackable (Tree a) where
--      reader = readTree
--   
genUnpackableInstance :: [PackingFlag] -> Name -> Q [Dec] -- | Generates an function to read (i.e. deserialise) the given data type. -- -- Example: -- -- For the Tree data type, it generates the following function: -- --
--   readTree :: (Unpackable a) => PackedReader '[Tree a] r (Tree a)
--   readTree = caseTree
--       (reader >>= \leafContent ->
--            return $ Leaf leafContent
--       )
--   
--       (reader >>= \leftContent ->
--        reader >>= \rightContent ->
--            return $ Node leftContent rightContent
--       )
--   
-- -- Note We use bindings (>>=) intead of a -- do-notation, since Reader is not a monad. It's an indexed -- monad, meaning that the user would have to enable the -- QualifiedDo extenstion for it to compile. genRead :: [PackingFlag] -> Name -> Q [Dec] -- | Generates an instance of Skippable for the given type -- -- All the parameters of each constructor should be instances of -- Skippable -- -- Example -- -- For the Tree data type, it generates the following instance: -- --
--   instance (Skippable a) => Skippable (Tree a) where
--       skip = skipTree
--   
genSkippableInstance :: [PackingFlag] -> Name -> Q [Dec] -- | Generates an function to skip a value of the given type in a -- Packed -- -- Example: -- -- For the Tree data type, it generates the following function: -- --
--   skipTree :: (Skippable a) => PackedReader '[Tree a] r ()
--   skipTree = caseTree
--        skip
--        (skipTree >> skipTree)
--   
genSkip :: [PackingFlag] -> Name -> Q [Dec] genTransform :: [PackingFlag] -> Name -> Q [Dec] -- | Byte in a Packed value to identify which data constructor is -- serialised type Tag = Word8 -- | This module provides instances of Packable and -- Unpackable for basic types like List and Maybe module Data.Packed.Instances caseList :: forall (r :: [Type]) b a. PackedReader ('[] :: [Type]) r b -> PackedReader '[a, [a]] r b -> PackedReader '[[a]] r b start9193 :: forall a (r :: [Type]) (t :: [Type]). NeedsBuilder ([a] ': r) t r t writeCon9193 :: forall a (r :: [Type]) (t :: [Type]). NeedsWriter [a] r t start58 :: forall a (r :: [Type]) (t :: [Type]). NeedsBuilder ([a] ': r) t (a ': ([a] ': r)) t writeCon58 :: forall a (r :: [Type]) (t :: [Type]). Packable a => a -> [a] -> NeedsWriter [a] r t writeList :: forall a (r :: [Type]) (t :: [Type]). Packable a => [a] -> NeedsWriter [a] r t readList :: forall a (r :: [Type]). Unpackable a => PackedReader '[[a]] r [a] pack9193 :: Packable a => Packed '[[a]] pack58 :: Packable a => a -> [a] -> Packed '[[a]] repack9193 :: Needs ('[] :: [Type]) '[[a]] repack58 :: Needs ('[] :: [Type]) '[a] -> Needs ('[] :: [Type]) '[[a]] -> Needs ('[] :: [Type]) '[[a]] skipList :: forall a (r :: [Type]). Skippable a => PackedReader '[[a]] r () transformList :: forall a (r :: [Type]). PackedReader '[a, [a]] r (NeedsBuilder '[a, [a]] '[[a]] ('[] :: [Type]) '[[a]]) -> PackedReader '[[a]] r (Needs ('[] :: [Type]) '[[a]]) caseMaybe :: forall (r :: [Type]) b a. PackedReader ('[] :: [Type]) r b -> PackedReader '[a] r b -> PackedReader '[Maybe a] r b startNothing :: forall a (r :: [Type]) (t :: [Type]). NeedsBuilder (Maybe a ': r) t r t writeConNothing :: forall a (r :: [Type]) (t :: [Type]). NeedsWriter (Maybe a) r t startJust :: forall a (r :: [Type]) (t :: [Type]). NeedsBuilder (Maybe a ': r) t (a ': r) t writeConJust :: forall a (r :: [Type]) (t :: [Type]). Packable a => a -> NeedsWriter (Maybe a) r t writeMaybe :: forall a (r :: [Type]) (t :: [Type]). Packable a => Maybe a -> NeedsWriter (Maybe a) r t readMaybe :: forall a (r :: [Type]). Unpackable a => PackedReader '[Maybe a] r (Maybe a) packNothing :: Packable a => Packed '[Maybe a] packJust :: Packable a => a -> Packed '[Maybe a] repackNothing :: Needs ('[] :: [Type]) '[Maybe a] repackJust :: Needs ('[] :: [Type]) '[a] -> Needs ('[] :: [Type]) '[Maybe a] skipMaybe :: forall a (r :: [Type]). Skippable a => PackedReader '[Maybe a] r () transformMaybe :: forall a (r :: [Type]). PackedReader '[a] r (NeedsBuilder '[a] '[Maybe a] ('[] :: [Type]) '[Maybe a]) -> PackedReader '[Maybe a] r (Needs ('[] :: [Type]) '[Maybe a]) caseEither :: forall a (r :: [Type]) b1 b2. PackedReader '[a] r b1 -> PackedReader '[b2] r b1 -> PackedReader '[Either a b2] r b1 startLeft :: forall a b (r :: [Type]) (t :: [Type]). NeedsBuilder (Either a b ': r) t (a ': r) t writeConLeft :: forall a b (r :: [Type]) (t :: [Type]). Packable a => a -> NeedsWriter (Either a b) r t startRight :: forall a b (r :: [Type]) (t :: [Type]). NeedsBuilder (Either a b ': r) t (b ': r) t writeConRight :: forall b a (r :: [Type]) (t :: [Type]). Packable b => b -> NeedsWriter (Either a b) r t writeEither :: forall a b (r :: [Type]) (t :: [Type]). (Packable a, Packable b) => Either a b -> NeedsWriter (Either a b) r t readEither :: forall a b (r :: [Type]). (Unpackable a, Unpackable b) => PackedReader '[Either a b] r (Either a b) packLeft :: (Packable a, Packable b) => a -> Packed '[Either a b] packRight :: (Packable a, Packable b) => b -> Packed '[Either a b] repackLeft :: Needs ('[] :: [Type]) '[a] -> Needs ('[] :: [Type]) '[Either a b] repackRight :: Needs ('[] :: [Type]) '[b] -> Needs ('[] :: [Type]) '[Either a b] skipEither :: forall a b (r :: [Type]). (Skippable a, Skippable b) => PackedReader '[Either a b] r () transformEither :: forall a (r :: [Type]) b. PackedReader '[a] r (NeedsBuilder '[a] '[Either a b] ('[] :: [Type]) '[Either a b]) -> PackedReader '[b] r (NeedsBuilder '[b] '[Either a b] ('[] :: [Type]) '[Either a b]) -> PackedReader '[Either a b] r (Needs ('[] :: [Type]) '[Either a b]) instance (Data.Packed.Packable.Packable a, Data.Packed.Packable.Packable b) => Data.Packed.Packable.Packable (GHC.Internal.Data.Either.Either a b) instance Data.Packed.Packable.Packable a => Data.Packed.Packable.Packable [a] instance Data.Packed.Packable.Packable a => Data.Packed.Packable.Packable (GHC.Internal.Maybe.Maybe a) instance (Data.Packed.Skippable.Skippable a, Data.Packed.Skippable.Skippable b) => Data.Packed.Skippable.Skippable (GHC.Internal.Data.Either.Either a b) instance Data.Packed.Skippable.Skippable a => Data.Packed.Skippable.Skippable [a] instance Data.Packed.Skippable.Skippable a => Data.Packed.Skippable.Skippable (GHC.Internal.Maybe.Maybe a) instance (Data.Packed.Unpackable.Unpackable a, Data.Packed.Unpackable.Unpackable b) => Data.Packed.Unpackable.Unpackable (GHC.Internal.Data.Either.Either a b) instance Data.Packed.Unpackable.Unpackable a => Data.Packed.Unpackable.Unpackable [a] instance Data.Packed.Unpackable.Unpackable a => Data.Packed.Unpackable.Unpackable (GHC.Internal.Maybe.Maybe a) module Data.Packed class Packable a write :: forall (r :: [Type]) (t :: [Type]). Packable a => a -> NeedsWriter a r t pack :: Packable a => a -> Packed '[a] -- | An Unpackable is a value that can be read (i.e. deserialised) -- from a Packed value class Unpackable a -- | The PackedReader to unpack a value of that type reader :: forall (r :: [Type]). Unpackable a => PackedReader '[a] r a -- | In a PackedReader, reads a value without moving the cursor readerWithoutShift :: forall a (r :: [Type]). Unpackable a => PackedReader (a ': r) (a ': r) a -- | Deserialise a value from a Packed. -- -- Returns the unconsumed Packed portion unpack :: forall a (r :: [Type]). Unpackable a => Packed (a ': r) -> (a, Packed r) -- | Same as unpack, but throws away the unconsumed bytes unpack' :: forall a (r :: [Type]). Unpackable a => Packed (a ': r) -> a -- | A buffer where packed values can be written The order to write these -- values is defined by the l type list -- -- If p is an empty list, then a value of type t can be -- extracted from that buffer. (See finish) data Needs (p :: [Type]) (t :: [Type]) withEmptyNeeds :: forall (a :: [Type]) (b :: [Type]) (x :: [Type]) (y :: [Type]). NeedsBuilder a b x y -> Needs x y -- | Write a value into a Needs, along with its FieldSize writeWithFieldSize :: forall a (r :: [Type]) (t :: [Type]). Packable a => a -> NeedsWriter' '[FieldSize, a] r t -- | Turns a Needs value (that does not expect to be written to) to -- a Packed finish :: forall (t :: [Type]). Needs ('[] :: [Type]) t -> Packed t unsafeCastNeeds :: forall (a :: [Type]) (b :: [Type]) (c :: [Type]) (d :: [Type]). Needs a b -> Needs c d -- | A buffer that contains one or more packed (i.e. serialised) values. -- The order of the values in the buffer is defined by the l -- type list data Packed (l :: [Type]) -- | Allows skipping over a field without having to unpack it skipWithFieldSize :: forall a (r :: [Type]). PackedReader '[FieldSize, a] r () -- | Splits the Packed value, and isolate the first encoded value. isolate :: forall a (r :: [Type]). PackedReader '[FieldSize, a] r (Packed '[a]) -- | Extracts the raw buffer from a Packed value fromPacked :: forall (a :: [Type]). Packed a -> ByteString -- | UNSAFE: Casts a generic ByteString into a Needs unsafeToPacked :: forall (a :: [Type]). ByteString -> Packed a -- | UNSAFE: Casts a typed Packed value into another Packed -- value of another type unsafeCastPacked :: forall (a :: [Type]) (b :: [Type]). Packed a -> Packed b -- | Basically a function that reads/desrialises a value from a -- Packed -- -- p the types of the packed values to read -- -- r the packed type after the encoded values to read -- -- v the type of the value to unpack -- -- Note: It is an indexed monad. data PackedReader (p :: [Type]) (r :: [Type]) v -- | Builds a PackedReader mkPackedReader :: forall (p :: [Type]) (r :: [Type]) v. (ReaderPtr (p :++: r) -> Int -> IO (v, ReaderPtr r, Int)) -> PackedReader p r v -- | Run the reading function using a ByteString. runReader :: forall (p :: [Type]) (r :: [Type]) v. PackedReader p r v -> Packed (p :++: r) -> IO (v, Packed r) -- | Produces a reader for a value preceded by its FieldSize readerWithFieldSize :: forall a (r :: [Type]). Unpackable a => PackedReader '[FieldSize, a] r a -- | Generate the following for the given type -- -- -- -- Example: -- --
--   $(mkPacked ''Tree [InsertFieldSize])
--   
mkPacked :: Name -> [PackingFlag] -> Q [Dec] -- | Options for the generation process. -- -- Beware: these options alter the signature and behaviour of the -- generated functions. data PackingFlag -- | When specified, each field in a packed data constructor will be -- preceded by a FieldSize, which indicates the size of the -- following packed value. -- -- Example -- -- As a consequence, for the following type, the caseTree -- function will have the following signature -- --
--   caseTree ::
--       (PackedReader (FieldSize ': a ': r) r b) ->
--       (PackedReader (FieldSize ': Tree a ': FieldSize ': Tree a ': r) r b) ->
--       PackedReader (Tree a ': r) r b
--   
InsertFieldSize :: PackingFlag -- | This flag should be used in complement to InsertFieldSize -- -- If set, no FieldSize will be inserted before the last parameter -- of the data constructor. -- -- Example -- -- If this flag is set (along with InsertFieldSize), for the -- following type, the caseTree function will have the following -- signature -- --
--   caseTree ::
--       (PackedReader (a ': r) r b) ->
--       (PackedReader (FieldSize ': Tree a ': Tree a ': r) r b) ->
--       PackedReader (Tree a ': r) r b
--   
SkipLastFieldSize :: PackingFlag -- | Type representation for the size of a packed data. The size is in -- bytes. -- -- Note: Take a look at the PackingFlags to understand how -- to use it data FieldSize -- | Returns the size of the packed value. -- -- Warning: For this to be accurate, there should only be one -- value packed in the binary strea. getFieldSizeFromPacked :: Packed '[a] -> FieldSize class Skippable a skip :: forall (r :: [Type]). Skippable a => PackedReader '[a] r ()