Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- type Getter a = Parser E a
- class Get a where
- runGet :: Get a => ByteString -> Either E (a, ByteString)
- runGetter :: Getter a -> ByteString -> Either E (a, ByteString)
- data E
- data EBase
- data EGeneric e
- = EGenericSum (EGenericSum e)
- | EGenericField String (Maybe String) Natural e
- data EGenericSum e
- eBase :: EBase -> Getter a
- getEBase :: Getter a -> EBase -> Getter a
- getGenericNonSum :: forall {cd} {f} {asserts} a. (Generic a, Rep a ~ D1 cd f, GTraverseNonSum cd (Parser E) f, asserts ~ '['NoEmpty, 'NoSum], ApplyGCAsserts asserts f) => Getter a
- getGenericSum :: forall {cd} {f} {asserts} pt a. (Generic a, Rep a ~ D1 cd f, GTraverseSum 'SumOnly cd (Parser E) f, Get pt, asserts ~ '['NoEmpty, 'NeedSum], ApplyGCAsserts asserts f) => PfxTagCfg pt -> Getter a
Documentation
Instances
(TypeError ENoEmpty :: Constraint) => Get Void Source # | |
Get Int8 Source # | Signed byte. |
Get Word8 Source # | Unsigned byte. |
Get Write Source # | Parse a bytestring and... immediate reserialize it. Note that this _does_ perform work: we make a new bytestring so we don't rely on the input bytestring. To use the input bytestring directly, see Binrep.Type.Thin. |
Get ByteString Source # | Return the rest of the input. A plain unannotated bytestring isn't very useful -- you'll usually want to null-terminate or length-prefix it. Note that this _does_ perform work: we make a new bytestring so we don't rely on the input bytestring. To use the input bytestring directly, see Binrep.Type.Thin. |
Defined in Binrep.Get.Flatparse get :: Getter ByteString Source # | |
Get () Source # | Unit type parses nothing. |
Defined in Binrep.Get.Flatparse | |
Get (NullTerminated ByteString) Source # | Parse a null-terminated bytestring. |
Defined in Binrep.Type.NullTerminated get :: Getter (NullTerminated ByteString) Source # | |
Get (Thin Write) Source # | |
Get (Thin ByteString) Source # | |
Defined in Binrep.Type.Thin | |
Get a => Get (Binreply a) Source # | |
Get a => Get [a] Source # | Parse elements until EOF. Sometimes used at the "top" of binary formats. |
Defined in Binrep.Get.Flatparse | |
(TypeError ENoSum :: Constraint) => Get (Either a b) Source # | |
Get (Endian 'BE Int16) Source # | |
Get (Endian 'BE Int32) Source # | |
Get (Endian 'BE Int64) Source # | |
Get (Endian 'BE Word16) Source # | |
Get (Endian 'BE Word32) Source # | |
Get (Endian 'BE Word64) Source # | |
Get (Endian 'LE Int16) Source # | |
Get (Endian 'LE Int32) Source # | |
Get (Endian 'LE Int64) Source # | |
Get (Endian 'LE Word16) Source # | |
Get (Endian 'LE Word32) Source # | |
Get (Endian 'LE Word64) Source # | |
Get (Endian end Int8) Source # | Endianness doesn't matter for single bytes. |
Get (Endian end Word8) Source # | Endianness doesn't matter for single bytes. |
(bs ~ MagicBytes a, ReifyBytes bs, KnownNat (Length bs)) => Get (Magic a) Source # | |
(BLen a, Get a, KnownNat n) => Get (NullPadded n a) Source # | |
Defined in Binrep.Type.NullPadded get :: Getter (NullPadded n a) Source # | |
(Prefix pfx, GetSize a, Get pfx) => Get (SizePrefixed pfx a) Source # | |
Defined in Binrep.Type.Prefix.Size get :: Getter (SizePrefixed pfx a) Source # | |
(Get a, KnownNat n) => Get (Sized n a) Source # | |
(Get l, Get r) => Get (l, r) Source # | Parse tuples left-to-right. |
Defined in Binrep.Get.Flatparse | |
(Prefix pfx, GetCount f, Get pfx, Get a) => Get (CountPrefixed pfx f a) Source # | |
Defined in Binrep.Type.Prefix.Count get :: Getter (CountPrefixed pfx f a) Source # |
runGet :: Get a => ByteString -> Either E (a, ByteString) Source #
runGetter :: Getter a -> ByteString -> Either E (a, ByteString) Source #
Structured parse error.
E Int EMiddle | |
EFail | Unhandled parse error. You get this if you don't change a flatparse fail to an error. Should not be set except by library code. |
Instances
Generic E Source # | |
Show E Source # | |
Eq E Source # | |
GenericTraverse (Parser E) Source # | |
Defined in Binrep.Get.Flatparse type GenericTraverseC (Parser E) a # | |
GenericTraverseSum (Parser E) Source # | |
Defined in Binrep.Get.Flatparse genericTraverseSumPfxTagAction :: GenericTraverseC (Parser E) pt => String -> Parser E pt # genericTraverseSumNoMatchingCstrAction :: String -> [String] -> Text -> Parser E a # | |
type Rep E Source # | |
Defined in Binrep.Get.Flatparse | |
type GenericTraverseC (Parser E) a Source # | |
Defined in Binrep.Get.Flatparse |
EExpectedByte Word8 Word8 | expected first, got second |
EOverlong Int Int | expected first, got second |
EExpected ByteString ByteString | expected first, got second |
EFailNamed String | known fail |
EFailParse String ByteString Word8 | parse fail (where you parse a larger object, then a smaller one in it) |
ERanOut Int | ran out of input, needed precisely Actually a |
Instances
A generic context layer for a parse error of type e
.
Recursive: parse errors occurring in fields are wrapped up here. (Those errors may also have a generic context layer.)
Making this explicitly recursive may seem strange, but it clarifies that this data type is to be seen as a layer over a top-level type.
EGenericSum (EGenericSum e) | Parse error relating to sum types (constructors). |
EGenericField | Parse error in a constructor field. |
Instances
Generic (EGeneric e) Source # | |
Show e => Show (EGeneric e) Source # | |
Eq e => Eq (EGeneric e) Source # | |
type Rep (EGeneric e) Source # | |
Defined in Binrep.Get.Flatparse type Rep (EGeneric e) = D1 ('MetaData "EGeneric" "Binrep.Get.Flatparse" "binrep-0.5.0-inplace" 'False) (C1 ('MetaCons "EGenericSum" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (EGenericSum e))) :+: C1 ('MetaCons "EGenericField" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe String))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Natural) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 e)))) |
data EGenericSum e Source #
EGenericSumTag e | Parse error parsing prefix tag. |
EGenericSumTagNoMatch | Unable to match a constructor to the parsed prefix tag. |
Instances
getGenericNonSum :: forall {cd} {f} {asserts} a. (Generic a, Rep a ~ D1 cd f, GTraverseNonSum cd (Parser E) f, asserts ~ '['NoEmpty, 'NoSum], ApplyGCAsserts asserts f) => Getter a Source #