bytepatch-0.2.0: Patch byte-representable data in a bytestream.
Safe HaskellNone
LanguageHaskell2010

BytePatch.Pretty.PatchRep

Synopsis

Documentation

class PatchRep a where Source #

Type has a binary representation for using in patchscripts.

Patchscripts are parsed parameterized over the type to edit. That type needs to become a bytestring for eventual patch application. We're forced into newtypes and typeclasses by Aeson already, so this just enables us to define some important patch generation behaviour in one place. Similarly to Aeson, if you require custom behaviour for existing types (e.g. length-prefixed strings instead of C-style null terminated), define a newtype over it.

Some values may not have valid patch representations, for example if you're patching a 1-byte length-prefixed string and your string is too long (>255 encoded bytes). Thus, toPatchRep is failable.

Instances

Instances details
PatchRep ByteString Source #

Bytestrings are copied as-is.

Instance details

Defined in BytePatch.Pretty.PatchRep

PatchRep Text Source #

Text is converted to UTF-8 bytes and null-terminated.

Instance details

Defined in BytePatch.Pretty.PatchRep

PatchRep HexByteString Source # 
Instance details

Defined in BytePatch.Pretty.HexByteString

KnownNat n => PatchRep (PascalText n) Source # 
Instance details

Defined in BytePatch.Pretty.PascalText