cuddle-0.5.0.0: CDDL Generator and test utilities
Safe HaskellNone
LanguageGHC2021

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:

  1. First, we deal with any rule extensions and create a single map from identifiers to (potentially parametrised) entities.
  2. Second, we flatten the structure to a CTree, which discards a lot of the extrenuous information.
  3. 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.
  4. Finally, we monomorphise, synthesizing instances of rules with their generic arguments bound.
Synopsis

Documentation

buildRefCTree :: CDDLMap -> RefCTree Source #

Build a CTree incorporating references.

This translation cannot fail.

asMap :: CDDL -> CDDLMap Source #

data MonoRef a Source #

Constructors

MIt a 
MRuleRef Name 

Instances

Instances details
Functor MonoRef Source # 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve

Methods

fmap :: (a -> b) -> MonoRef a -> MonoRef b #

(<$) :: a -> MonoRef b -> MonoRef a #

Show (CTree MonoRef) Source # 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve

Show a => Show (MonoRef a) Source # 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve

Methods

showsPrec :: Int -> MonoRef a -> ShowS #

show :: MonoRef a -> String #

showList :: [MonoRef a] -> ShowS #

Show (poly (Node MonoRef)) => Show (CTreeRoot' poly MonoRef) Source # 
Instance details

Defined in Codec.CBOR.Cuddle.CDDL.Resolve