Safe Haskell | None |
---|---|
Language | GHC2021 |
Codec.CBOR.Cuddle.CDDL.Resolve
Description
Module containing tools for resolving
CDDL
Resolving the CDDL is a process of simplifying the representation to make further operations, such as CBOR generation or validation, easier. We operate with a number of passes:
- First, we deal with any rule extensions and create a single map from identifiers to (potentially parametrised) entities.
- Second, we flatten the structure to a
CTree
, which discards a lot of the extrenuous information. - Then we resolve identifiers. Specifically, we do three things: - Resolve identifiers that map to the postlude. - Differentiate between generic args and references to top-level rules. - Validate that all references exist. Note that we cannot resolve all references since they may be circular.
- Finally, we monomorphise, synthesizing instances of rules with their generic arguments bound.
Synopsis
- buildResolvedCTree :: CTreeRoot OrRef -> Either NameResolutionFailure (CTreeRoot DistRef)
- buildRefCTree :: CDDLMap -> RefCTree
- asMap :: CDDL -> CDDLMap
- buildMonoCTree :: CTreeRoot DistRef -> Either NameResolutionFailure (CTreeRoot' Identity MonoRef)
- fullResolveCDDL :: CDDL -> Either NameResolutionFailure (CTreeRoot' Identity MonoRef)
- data MonoRef a
- data NameResolutionFailure
- = UnboundReference Name
- | MismatchingArgs Name [Name]
- | ArgsToPostlude PTerm [Node OrRef]
Documentation
buildResolvedCTree :: CTreeRoot OrRef -> Either NameResolutionFailure (CTreeRoot DistRef) Source #
buildRefCTree :: CDDLMap -> RefCTree Source #
Build a CTree incorporating references.
This translation cannot fail.
buildMonoCTree :: CTreeRoot DistRef -> Either NameResolutionFailure (CTreeRoot' Identity MonoRef) Source #
data NameResolutionFailure Source #
Constructors
UnboundReference Name | |
MismatchingArgs Name [Name] | |
ArgsToPostlude PTerm [Node OrRef] |
Instances
Show NameResolutionFailure Source # | |
Defined in Codec.CBOR.Cuddle.CDDL.Resolve Methods showsPrec :: Int -> NameResolutionFailure -> ShowS # show :: NameResolutionFailure -> String # showList :: [NameResolutionFailure] -> ShowS # |