Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Meta = Meta {}
- data MetaStream a = MetaStream {
- msNullTerminates :: Maybe (SeekRep 'FwdSeek)
- msExpected :: Maybe a
- data Cfg = Cfg {}
- data Error a
- = ErrorBadBinRep a String
- | ErrorUnexpectedNonNull Bytes
- | ErrorDidNotMatchExpected Bytes Bytes
- | ErrorBinRepTooLong Bytes Natural
- patchBinRep :: forall a s ss rs is i r. (BinRep a, Traversable (FunctorRec rs), r ~ Const Meta, rs ~ RDelete r ss, RElem r ss i, RSubset rs ss is) => Patch s ss a -> Either (Error a) (Patch s rs Bytes)
- class BinRep a where
- toBinRep' :: BinRep a => a -> Either (Error a) Bytes
- check :: BinRep a => Cfg -> Bytes -> MetaStream a -> Either (Error a) ()
Documentation
data MetaStream a Source #
MetaStream | |
|
Instances
Cfg | |
|
ErrorBadBinRep a String | |
ErrorUnexpectedNonNull Bytes | |
ErrorDidNotMatchExpected Bytes Bytes | |
ErrorBinRepTooLong Bytes Natural |
Instances
Functor Error Source # | |
Foldable Error Source # | |
Defined in StreamPatch.Patch.Binary fold :: Monoid m => Error m -> m # foldMap :: Monoid m => (a -> m) -> Error a -> m # foldMap' :: Monoid m => (a -> m) -> Error a -> m # foldr :: (a -> b -> b) -> b -> Error a -> b # foldr' :: (a -> b -> b) -> b -> Error a -> b # foldl :: (b -> a -> b) -> b -> Error a -> b # foldl' :: (b -> a -> b) -> b -> Error a -> b # foldr1 :: (a -> a -> a) -> Error a -> a # foldl1 :: (a -> a -> a) -> Error a -> a # elem :: Eq a => a -> Error a -> Bool # maximum :: Ord a => Error a -> a # minimum :: Ord a => Error a -> a # | |
Traversable Error Source # | |
Eq a => Eq (Error a) Source # | |
Show a => Show (Error a) Source # | |
Generic (Error a) Source # | |
type Rep (Error a) Source # | |
Defined in StreamPatch.Patch.Binary |
patchBinRep :: forall a s ss rs is i r. (BinRep a, Traversable (FunctorRec rs), r ~ Const Meta, rs ~ RDelete r ss, RElem r ss i, RSubset rs ss is) => Patch s ss a -> Either (Error a) (Patch s rs Bytes) 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
BinRep String Source # | String is the same but goes the long way round, through Text. |
BinRep ByteString Source # | Bytestrings are copied as-is. |
Defined in StreamPatch.Patch.Binary | |
BinRep Text Source # | Text is converted to UTF-8 bytes and null-terminated. |
BinRep HexByteString Source # | |
Defined in BytePatch.HexByteString | |
KnownNat n => BinRep (PascalText n) Source # | |
Defined in StreamPatch.Patch.Binary.PascalText |