Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type Entry = ByteString
- data Entries
- putEntries :: [Entry] -> Builder
- packEntries :: [Entry] -> ByteString
- readEntries :: ByteString -> Entries
- entriesToList :: Entries -> [Entry]
- entriesToListNoFail :: Entries -> [Entry]
- data Archiver = Archiver {
- archiveWrite :: [Entry] -> ByteString
- archiveRead :: ByteString -> Entries
- defaultArchiver :: Archiver
Documentation
putEntries :: [Entry] -> Builder Source #
packEntries :: [Entry] -> ByteString Source #
readEntries :: ByteString -> Entries Source #
entriesToList :: Entries -> [Entry] Source #
Convert Entries
to a normal list, calling error
if there was
a failure in unpacking the archive.
entriesToListNoFail :: Entries -> [Entry] Source #
Convert Entries
to a normal list, silently ignoring a failure
to unpack the archive and instead returning a truncated list.
Interface for the lowest level of the serialisation layer, which
handles packing lists of Entry
elements (essentially just
bytestrings) into a single bytestring, perhaps with error-checking.
Any
must satisfy the
round-trip property:Archiver
{archiveWrite
, archiveRead
}
forall xs . entriesToList (archiveRead (archiveWrite xs)) == xs
Moreover, archiveWrite
must be a monoid homomorphism, so that
concatenating archives is equivalent to concatenating the lists of
entries that they represent:
archiveWrite [] == empty forall xs ys . archiveWrite xs <> archiveWrite ys == archiveWrite (xs ++ ys)
Archiver | |
|
defaultArchiver :: Archiver Source #
Standard (and historically the only) implementation of the
Archiver
interface. This represents each entry in the following
format:
| entry length | crc16 | entry | | 8 bytes | 2 bytes | n bytes |