Portability | non-portable (GHC-only) |
---|---|

Stability | experimental |

Maintainer | audreyt@audreyt.org |

Safe Haskell | None |

This module handles pre-parsed chunks in AFP files.

- type NStr = Buffer0
- type AStr = NStr
- type ChunkWriter c = WriterT (ChunkQueue c)
- type WriterStateIO v a = (Chunk c, MonadReader v m) => ChunkWriter c m a
- nullForeignPtr :: ForeignPtr a
- _NStr :: NStr
- packAStr :: AStr -> ByteString
- fromAStr :: AStr -> String
- toAStr :: String -> AStr
- packNStr :: NStr -> ByteString
- fromNStr :: NStr -> [N1]
- toNStr :: [N1] -> NStr
- newtype ChunkType = MkChunkType TypeRep
- mkChunkType :: TypeRep -> ChunkType
- typeInt :: TypeRep -> Int
- chunkTypeOf :: Typeable a => a -> ChunkType
- class (Show c, Typeable c, Buf (BufOf c), Enum (N c), Num (N c)) => Chunk c where
- type N c
- type BufOf c
- chunkApply :: N c -> c -> (forall a. Rec a => a -> x) -> x
- mkChunk :: N c -> BufOf c -> c
- chunkCon :: (N c, BufOf c) -> c
- chunkDecon :: c -> (N c, BufOf c)
- chunkType :: c -> ChunkType
- chunkTypeLookup :: c -> N c -> ChunkType
- packChunk :: c -> PStringLen
- chunkMapFiltersM_ :: Monad m => c -> [(ChunkType, c -> m [c])] -> m ()
- chunkMapFiltersM :: Monad m => c -> [(ChunkType, c -> m [c])] -> m [c]
- chunksMapFiltersM :: Monad m => [c] -> [(ChunkType, c -> m [c])] -> m [c]
- chunksMapFiltersM_ :: Monad m => [c] -> [(ChunkType, c -> m [c])] -> m ()
- decodeChunk :: Binary (Record r) => c -> r
- encodeChunk :: (Binary r, Storable r, Rec r) => r -> c

- class (Rec r, Chunk (ChunkOf r)) => RecChunk r where
- type ChunkOf r
- readChunks :: r -> [ChunkOf r]
- writeChunks :: Monad m => r -> m [ChunkOf r] -> m r

- class (Rec a, Rec b) => RecData a b where
- (~~) :: (Chunk c, Typeable t) => c -> t -> Bool
- (<~~) :: (Monad m, Chunk c, Typeable t, Rec r) => t -> [c] -> m r
- (~~>) :: (Monad m, Chunk c, Typeable t, Rec r) => [c] -> t -> m r
- (==>) :: (Chunk c, Monad m) => [c] -> [(ChunkType, c -> m [c])] -> m [c]
- (<==) :: (Chunk c, Monad m) => [(ChunkType, c -> m [c])] -> [c] -> m [c]
- (..>) :: (Chunk c, Monad m) => [c] -> [(ChunkType, c -> m [c])] -> m ()
- (<..) :: (Chunk c, Monad m) => [(ChunkType, c -> m [c])] -> [c] -> m ()
- (===) :: (Monad m, Rec r, Chunk c) => r -> (r -> ChunkWriter c m a) -> (ChunkType, c -> m [c])
- processChunk :: (Monad m, Rec r, Chunk c) => r -> (r -> ChunkWriter c m a) -> c -> m [c]
- (...) :: (Monad m, Rec a, Chunk c) => a -> (a -> m t) -> (ChunkType, c -> m [c])
- (....) :: (Monad (t1 m), Monad m, MonadTrans t1, Rec a, Chunk c) => a -> (a -> m t) -> (ChunkType, c -> t1 m [c])
- (.....) :: (Monad (t1 (t2 m)), Monad (t2 m), Monad m, MonadTrans t1, MonadTrans t2, Rec a, Chunk c) => a -> (a -> m t) -> (ChunkType, c -> t1 (t2 m) [c])
- inspectChunk :: (Monad m, Rec a, Chunk c) => a -> (a -> m t) -> c -> m [c]
- push :: (Chunk c, Monad m, Rec a) => a -> ChunkWriter c m ()
- filterChunks :: (Monad m, RecChunk r, Chunk c) => r -> [(ChunkType, ChunkOf r -> ChunkWriter c m [ChunkOf r])] -> ChunkWriter c m ()
- data ChunkQueue a
- = ChunkQueue [a]
- | ChunkItem a

# Documentation

type ChunkWriter c = WriterT (ChunkQueue c)Source

type WriterStateIO v a = (Chunk c, MonadReader v m) => ChunkWriter c m aSource

packAStr :: AStr -> ByteStringSource

packNStr :: NStr -> ByteStringSource

chunkTypeOf :: Typeable a => a -> ChunkTypeSource

class (Show c, Typeable c, Buf (BufOf c), Enum (N c), Num (N c)) => Chunk c whereSource

The Chunk class represents non-parsed chunks, constructed from a (ChunkType, Buffer) tuple.

chunkApply :: N c -> c -> (forall a. Rec a => a -> x) -> xSource

mkChunk :: N c -> BufOf c -> cSource

chunkCon :: (N c, BufOf c) -> cSource

chunkDecon :: c -> (N c, BufOf c)Source

chunkType :: c -> ChunkTypeSource

chunkTypeLookup :: c -> N c -> ChunkTypeSource

packChunk :: c -> PStringLenSource

chunkMapFiltersM_ :: Monad m => c -> [(ChunkType, c -> m [c])] -> m ()Source

chunkMapFiltersM :: Monad m => c -> [(ChunkType, c -> m [c])] -> m [c]Source

chunksMapFiltersM :: Monad m => [c] -> [(ChunkType, c -> m [c])] -> m [c]Source

chunksMapFiltersM_ :: Monad m => [c] -> [(ChunkType, c -> m [c])] -> m ()Source

decodeChunk :: Binary (Record r) => c -> rSource

encodeChunk :: (Binary r, Storable r, Rec r) => r -> cSource

class (Rec r, Chunk (ChunkOf r)) => RecChunk r whereSource

The RecChunk class unifies a Rec (parent) with its contained chunk types (children).

readChunks :: r -> [ChunkOf r]Source

writeChunks :: Monad m => r -> m [ChunkOf r] -> m rSource

class (Rec a, Rec b) => RecData a b whereSource

The RecData class unifies a Rec (parent) with its contained Rec data type (children).

(===) :: (Monad m, Rec r, Chunk c) => r -> (r -> ChunkWriter c m a) -> (ChunkType, c -> m [c])Source

processChunk :: (Monad m, Rec r, Chunk c) => r -> (r -> ChunkWriter c m a) -> c -> m [c]Source

(....) :: (Monad (t1 m), Monad m, MonadTrans t1, Rec a, Chunk c) => a -> (a -> m t) -> (ChunkType, c -> t1 m [c])Source

(.....) :: (Monad (t1 (t2 m)), Monad (t2 m), Monad m, MonadTrans t1, MonadTrans t2, Rec a, Chunk c) => a -> (a -> m t) -> (ChunkType, c -> t1 (t2 m) [c])Source

inspectChunk :: (Monad m, Rec a, Chunk c) => a -> (a -> m t) -> c -> m [c]Source

filterChunks :: (Monad m, RecChunk r, Chunk c) => r -> [(ChunkType, ChunkOf r -> ChunkWriter c m [ChunkOf r])] -> ChunkWriter c m ()Source

data ChunkQueue a Source

ChunkQueue [a] | |

ChunkItem a |

Show a => Show (ChunkQueue a) | |

Monoid (ChunkQueue a) |