Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- data EGenericSum
- eBase :: EBase -> Getter a
- getEWrap :: Get a => (E -> E) -> Getter a
- getEBase :: Get a => EBase -> Getter a
- cutEBase :: Getter a -> EBase -> Getter a
- class GetWith (r :: TYPE rep) a | a -> r where
- runGetWith :: GetWith (r :: TYPE LiftedRep) a => r -> ByteString -> Either E (a, ByteString)
Documentation
Instances
Get Void Source # | Impossible to parse |
Get Int8 Source # | |
Get Word8 Source # | |
Get DCS Source # | |
Get DSS Source # | |
Get DU Source # | |
Get DX Source # | |
Get Tar Source # | |
Get Tiff Source # | |
Get WavHeader Source # | |
Get ByteString Source # | |
Defined in Binrep.Get get :: Getter ByteString Source # | |
(bs ~ MagicBytes (TiffMagic end), ReifyBytes bs, irep ~ I 'U 'I4 end, Get irep) => Get (TiffBody end) Source # | |
Get (AsciiNat 8) Source # | |
Get (AsByteString 'C) Source # | |
Defined in Binrep.Type.ByteString | |
(itype ~ I 'U size end, irep ~ IRep 'U size, Integral irep, Get itype) => Get (AsByteString ('Pascal size end)) Source # | |
Defined in Binrep.Type.ByteString | |
KnownSymbol str => Get (MagicUTF8 str) Source # | |
Get a => Get [a] Source # | Parse heterogeneous lists in order. No length indicator, so either fails or succeeds by reaching EOF. Probably not what you usually want, but sometimes used at the "top" of binary formats. |
Defined in Binrep.Get | |
Get a => Get (Table 'Strong a) Source # | |
KnownNat n => Get (TarNat n) Source # | |
(bs ~ MagicBytes a, ReifyBytes bs) => Get (Magic a) Source # | |
(Get a, BLen a, KnownNat n) => Get (NullPadded n a) Source # | Safety: we assert actual length is within expected length (in order to calculate how much padding to parse). Note that the consumer probably doesn't care about the content of the padding, just that the data is chunked correctly. I figure we care about correctness here, so it'd be nice to know about the padding well-formedness (i.e. that it's all nulls). TODO maybe better definition via isolate |
Defined in Binrep.Type.NullPadded get :: Getter (NullPadded n a) Source # | |
(Get a, KnownNat n) => Get (Sized n a) Source # | |
(Get a, KnownNat n) => Get (Vector n a) Source # | |
(Get a, Get b) => Get (a, b) Source # | |
Defined in Binrep.Get | |
Get (I 'S 'I1 e) Source # | |
Get (I 'S 'I2 'BE) Source # | |
Get (I 'S 'I2 'LE) Source # | |
Get (I 'S 'I4 'BE) Source # | |
Get (I 'S 'I4 'LE) Source # | |
Get (I 'S 'I8 'BE) Source # | |
Get (I 'S 'I8 'LE) Source # | |
Get (I 'U 'I1 e) Source # | |
Get (I 'U 'I2 'BE) Source # | |
Get (I 'U 'I2 'LE) Source # | |
Get (I 'U 'I4 'BE) Source # | |
Get (I 'U 'I4 'LE) Source # | |
Get (I 'U 'I8 'BE) Source # | |
Get (I 'U 'I8 'LE) Source # | |
(itype ~ I 'U size end, irep ~ IRep 'U size, Get itype, Integral irep, Get a, KnownNat (MaxBound irep)) => Get (LenPfx size end a) Source # | |
(VarintContinuation cont, Integral i, Bits i) => Get (Varnat 'Bijective cont 'BE i) Source # | TODO nothing to test against - unsure if correct |
(VarintContinuation cont, Integral i, Bits i) => Get (Varnat 'Bijective cont 'LE i) Source # | Git varint (cont=on), BPS (beat patches) (cont=off) |
(VarintContinuation cont, Integral i, Bits i) => Get (Varnat 'Redundant cont 'BE i) Source # | VLQ (cont=on) |
(VarintContinuation cont, Integral i, Bits i) => Get (Varnat 'Redundant cont 'LE i) Source # | protobuf (cont=on), LEB128 (cont=on) not truly infinite length since shifters take |
runGet :: Get a => ByteString -> Either E (a, ByteString) Source #
runGetter :: Getter a -> ByteString -> Either E (a, ByteString) Source #
Instances
Generic E Source # | |
Show E Source # | |
Eq E Source # | |
type Rep E Source # | |
Defined in Binrep.Get type Rep E = D1 ('MetaData "E" "Binrep.Get" "binrep-0.3.1-inplace" 'False) (C1 ('MetaCons "EBase" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EBase)) :+: C1 ('MetaCons "EGeneric" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EGeneric))) |
ENoVoid | |
EFail | |
EExpectedByte Word8 Word8 | expected first, got second |
EOverlong BLenT BLenT | 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 Natural | ran out of input, needed precisely |
Instances
Instances
Generic EGeneric Source # | |
Show EGeneric Source # | |
Eq EGeneric Source # | |
type Rep EGeneric Source # | |
Defined in Binrep.Get type Rep EGeneric = D1 ('MetaData "EGeneric" "Binrep.Get" "binrep-0.3.1-inplace" 'False) (C1 ('MetaCons "EGenericSum" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EGenericSum)) :+: 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 Source #
Instances
getEWrap :: Get a => (E -> E) -> Getter a Source #
TODO confirm correct operation (error combination)
class GetWith (r :: TYPE rep) a | a -> r where Source #
A type that can be parsed from binary given some environment.
Making this levity polymorphic makes things pretty strange, but is useful.
See Binrep.Example.FileTable
.
runGetWith :: GetWith (r :: TYPE LiftedRep) a => r -> ByteString -> Either E (a, ByteString) Source #