A canonical representation of CBOR data items. Two CanonicalTerms compare equal exactly when the underlying CBOR items are equivalent under the extended generic data model of RFC 8949 §3.4.3 — the same notion of equality that determines whether two map keys are duplicates (RFC 8949 §3.1, §5.6).
Differences from Term:
Major types 0 and 1 are split into CTInt and CTNInt (matching the on-wire structure) instead of overlapping in TInt/TInteger.
Bignums (tags 2 and 3) whose value fits in
[-2^64, 2^64 - 1]are normalized into CTInt / CTNInt (RFC 8949 §3.4.3).Definite- and indefinite-length variants are merged: there is no separate constructor for what TBytesI, TStringI, TListI, TMapI represent.
Maps use Map rather than a list of pairs, so key order is irrelevant.
TBool and TNull are folded into CTSimple (values 20, 21, 22 per RFC 8949 §3.3).
THalf, TFloat, TDouble remain distinct constructors: the generic data model treats different float widths as distinct items (RFC 8949 §2).
Instances5Eq, Ord, Show, Generic, Rep
Eq CanonicalTermDefined in cuddle-1.8.1.0 · Codec.CBOR.Cuddle.CBOR.CanonicalOrd CanonicalTermDefined in cuddle-1.8.1.0 · Codec.CBOR.Cuddle.CBOR.CanonicalShow CanonicalTermDefined in cuddle-1.8.1.0 · Codec.CBOR.Cuddle.CBOR.CanonicalGeneric CanonicalTermDefined in cuddle-1.8.1.0 · Codec.CBOR.Cuddle.CBOR.Canonicaltype Rep CanonicalTerm = D1 ('MetaDataDefined in cuddle-1.8.1.0 · Codec.CBOR.Cuddle.CBOR.Canonical"CanonicalTerm"
"Codec.CBOR.Cuddle.CBOR.Canonical"
"cuddle-1.8.1.0-1n67ahaIhMs3FQkr3b5WBN"
'False) (((C1 ('MetaCons"CTInt"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word64)) :+: C1 ('MetaCons"CTNInt"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 NInt))) :+: (C1 ('MetaCons"CTBytes"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)) :+: (C1 ('MetaCons"CTString"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons"CTList"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [CanonicalTerm]))))) :+: ((C1 ('MetaCons"CTMap"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map CanonicalTerm CanonicalTerm))) :+: (C1 ('MetaCons"CTTagged"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word64) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 CanonicalTerm)) :+: C1 ('MetaCons"CTSimple"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Word8)))) :+: (C1 ('MetaCons"CTHalf"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Half)) :+: (C1 ('MetaCons"CTFloat"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Float)) :+: C1 ('MetaCons"CTDouble"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Double))))))