diff --git a/CHANGELOG.md b/CHANGELOG.md index 320f5bf..66ac921 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## 1.1.0.0 +* Implement `IndexMappable` instance for + - `HuddleStage` to `CTreePhase` + - `HuddleStage` to `PrettyStage` * Change the order of fields in `GroupEntry`; the extension field is now the last field * Add `IndexMappable` to help with traversing `CDDL` trees * Add an index type parameter to all `CDDL` terms @@ -13,7 +16,7 @@ * Changed the type of the first argument for `generateCBORTerm` and `generateCBORTerm'` to `CTreeRoot` * Removed all exports in `Codec.CBOR.Cuddle.CBOR.Validator` except for - `validateCBOR` and `validateCBOR'` + `validateCBOR`, `validateCBOR'`, `CBORTermResult` and `CDDLResult` ## 1.0.0.0 diff --git a/src/Codec/CBOR/Cuddle/CBOR/Validator.hs b/src/Codec/CBOR/Cuddle/CBOR/Validator.hs index e763078..300f2a1 100644 --- a/src/Codec/CBOR/Cuddle/CBOR/Validator.hs +++ b/src/Codec/CBOR/Cuddle/CBOR/Validator.hs @@ -5,6 +5,8 @@ module Codec.CBOR.Cuddle.CBOR.Validator ( validateCBOR, validateCBOR', + CDDLResult (..), + CBORTermResult (..), ) where import Codec.CBOR.Cuddle.CDDL hiding (CDDL, Group, Rule) diff --git a/src/Codec/CBOR/Cuddle/IndexMappable.hs b/src/Codec/CBOR/Cuddle/IndexMappable.hs index eba4d78..70063cf 100644 --- a/src/Codec/CBOR/Cuddle/IndexMappable.hs +++ b/src/Codec/CBOR/Cuddle/IndexMappable.hs @@ -214,6 +214,34 @@ instance IndexMappable XXType2 ParserStage HuddleStage where instance IndexMappable XTerm ParserStage HuddleStage where mapIndex (ParserXTerm c) = HuddleXTerm c +-- HuddleStage -> CTreePhase + +instance IndexMappable XCddl HuddleStage CTreePhase where + mapIndex (HuddleXCddl c) = CTreeXCddl c + +instance IndexMappable XXTopLevel HuddleStage CTreePhase where + mapIndex (HuddleXXTopLevel c) = CTreeXXTopLevel c + +instance IndexMappable XXType2 HuddleStage CTreePhase where + mapIndex (HuddleXXType2 c) = CTreeXXType2 c + +instance IndexMappable XTerm HuddleStage CTreePhase where + mapIndex (HuddleXTerm c) = CTreeXTerm c + +-- HuddleStage -> PrettyStage + +instance IndexMappable XCddl HuddleStage PrettyStage where + mapIndex (HuddleXCddl c) = PrettyXCddl c + +instance IndexMappable XXTopLevel HuddleStage PrettyStage where + mapIndex (HuddleXXTopLevel c) = PrettyXXTopLevel c + +instance IndexMappable XXType2 HuddleStage PrettyStage where + mapIndex (HuddleXXType2 c) = absurd c + +instance IndexMappable XTerm HuddleStage PrettyStage where + mapIndex (HuddleXTerm c) = PrettyXTerm c + -- ParserStage -> ParserStage instance IndexMappable XCddl ParserStage ParserStage