OpenAFP-1.3.2: IBM AFP document format parser and generator

Portability | non-portable (GHC-only)
Stability | experimental
Maintainer | audreyt@audreyt.org
Safe Haskell | None

OpenAFP.Types.Chunk

Description

This module handles pre-parsed chunks in AFP files.

Synopsis

- 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
  - type DataOf a
  - type RecOf b
  - readData :: (DataOf a ~ b, RecOf b ~ a) => a -> [Record b]
  - writeData :: (DataOf a ~ b, RecOf b ~ a) => a -> [Record b] -> a
- (~~) :: (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 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

Constructors

MkChunkType TypeRep |

Instances

Eq ChunkType |
Ord ChunkType |
Show ChunkType |
Typeable ChunkType |

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

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

Associated Types

type N c

type BufOf c

Methods

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

Instances

Chunk T_ |
Chunk PTX_ |
Chunk MCF_ |
Chunk AFP_ |

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

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

Associated Types

type ChunkOf r

Methods

readChunks :: r -> [ChunkOf r]

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

Instances

RecChunk FilePath |
RecChunk MCF_T |
RecChunk PTX |
RecChunk MCF |
RecChunk TLE |

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

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

Associated Types

type DataOf a

type RecOf b

Methods

readData :: (DataOf a ~ b, RecOf b ~ a) => a -> [Record b]

writeData :: (DataOf a ~ b, RecOf b ~ a) => a -> [Record b] -> a

Instances

RecData FNI FNI_Data |
RecData FNM FNM_Data |
RecData MCF1 MCF1_Data |
RecData CFI CFI_Data |
RecData CPI CPI_Data |

(~~) :: (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

Constructors

ChunkQueue [a] |
ChunkItem a |

Instances

Show a => Show (ChunkQueue a) |
Monoid (ChunkQueue a) |