Safe Haskell | None |
---|---|
Language | Haskell2010 |
Low-level patchscript processing and application.
Patchscripts are applied as a list of (skip x, write in-place y)
commands. An
offset-based format is much simpler to use, however. This module processes such
offset patchscripts into a "linear" patchscript, and provides a stream patching
algorithm that can be applied to any forward-seeking byte stream.
Some core types are parameterized over the stream type/patch content. This enables writing patches in any form (e.g. UTF-8 text), which are then processed into an applicable patch by transforming edits into a concrete binary representation (e.g. null-terminated UTF-8 bytestring). See TODO module for more.
Synopsis
- class Monad m => MonadFwdByteStream m where
- data Cfg = Cfg {
- cfgWarnIfLikelyReprocessing :: Bool
- cfgAllowPartialExpected :: Bool
- data Error
- patchPure :: Cfg -> [Patch 'FwdSeek Bytes] -> ByteString -> Either Error ByteString
- patch :: MonadFwdByteStream m => Cfg -> [Patch 'FwdSeek Bytes] -> m (Maybe Error)
Patch interface
class Monad m => MonadFwdByteStream m where Source #
Patch time config.
Cfg | |
|
Errors encountered during patch time.
Prepared patchers
patchPure :: Cfg -> [Patch 'FwdSeek Bytes] -> ByteString -> Either Error ByteString Source #
Attempt to apply a patchscript to a ByteString
.