data-layout- Read/write arbitrary binary layouts to a "Data.Vector.Storable".

Safe HaskellSafe-Inferred




A DSL for describing data laid out in a regular fashion with a combination of structures and arrays.



repeat :: Reps -> Layout -> LayoutSource

Repeat a layout n times.

offset :: Bytes -> Layout -> LayoutSource

Skip n bytes before accessing the next part of the layout.

group :: Bytes -> Layout -> LayoutSource

Wrap a layout with a group which is n bytes in size.

Value Formats

word8 :: LayoutSource

8-bit word.

word16le :: LayoutSource

16-bit word, little endian.

word32le :: LayoutSource

32-bit word, little endian.

word64le :: LayoutSource

64-bit word, little endian.

word16be :: LayoutSource

16-bit word, big endian.

word32be :: LayoutSource

32-bit word, big endian.

word64be :: LayoutSource

64-bit word, big endian.


optimize :: Layout -> LayoutSource

Remove redundancies from a layout.


size :: Layout -> IntSource

Calculates the total size of the layout.

byteOrder :: Layout -> ByteOrderSource

Gets the byte order of the values in the layout.

valueSize1 :: Layout -> IntSource

Calculates the size of a single value in the layout.

valueSizeN :: Layout -> IntSource

Calculates the total size of the values stored in the layout.

valueCount :: Layout -> IntSource

Counts the number of times a value is repeated in the layout.

chunk :: Int -> Layout -> [Layout]Source

Splits a repeated layout in to multiple layouts each with a maximum of n repetitions.