Functions for querying Salix models.
deref : String -> L2 pos -> ResultME L3Error (L1.Declarable pos L2.RefChecked)
Dereferences an alias. If an alias is to another alias, since it consists only of a named type, this name will also be derferences recursively, until something that is not a named type is encountered.
transitiveClosure : L2 pos -> L2 pos -> ResultME L3Error (L2 pos)
Finds the transitive closure starting from a sub-set of declarations from an L2. Any type references in these declarations will pull their referred to declarations into the closure, and this process will be continued recursively until no more members are added to the closure.
This is useful if some declarations need to be generated from, including all their dependencies. For example, to code generate an encoder for a declaration that references other types by name, the encoders for those other types also need to be generated. The transitive closure gives the full set of declaration to generate encoders for to complete the code.
The first argument is the starting set, and the second argument is the complete model to select a transitive closure from.
transitiveClosure startingSet model
transitiveClosureWithoutStartingSet : L2 pos -> L2 pos -> ResultME L3Error (L2 pos)
Finds the transitive closure starting from a sub-set of declarations from an L2. Any type references in these declarations will pull their referred to declarations into the closure, and this process will be continued recursively until no more members are added to the closure.
The starting set itself will not be automatically included in the results. Members of the starting set may end up in the results, but only if they are dependencies of other members of the starting set.
This is useful if some declarations need to be generated from, including all their dependencies. For example, to code generate an encoder for a declaration that references other types by name, the encoders for those other types also need to be generated. The transitive closure gives the full set of declaration to generate encoders for to complete the code.
The first argument is the starting set, and the second argument is the complete model to select a transitive closure from.
transitiveClosureOfType : L1.Type pos L2.RefChecked -> L2 pos -> ResultME L3Error (L2 pos)
Starting from a type, computes the transitive closure from all outoing TNamed references within that type. This yields all declarations that a type depends on.
expectAlias : L1.Declarable pos ref -> ResultME L3Error ( pos, L1.Properties, L1.Type pos ref )
Expects a Declarable
to be a DAlias
otherwise its an error.
expectProduct : L1.Type pos ref -> ResultME L3Error ( pos, List.Nonempty.Nonempty (L1.Field pos ref) )
Expects a Type
to be a TProduct
otherwise its an error.
expectProductOrEmpty : L1.Type pos ref -> ResultME L3Error ( pos, List (L1.Field pos ref) )
Expects a Type
to be a TProduct
or TEmptyProduct
otherwise its an error.
L3.PropertiesAPI pos -> a -> ResultME L3Error Basics.Bool
Defines the type of a function that filters over a set of properties, to things that have a certain set of properties.
andPropFilter : PropertyFilter pos a -> PropertyFilter pos a -> PropertyFilter pos a
ANDs two PropertyFilter
s together.
notPropFilter : PropertyFilter pos a -> PropertyFilter pos a
Inverts a PropertyFilter
.
orPropFilter : PropertyFilter pos a -> PropertyFilter pos a -> PropertyFilter pos a
ORs two PropertyFilter
s together.
filterDictByProps : L3.PropertiesAPI pos -> PropertyFilter pos a -> Dict String a -> ResultME L3Error (Dict String a)
Filters the values in a Dict
by a PropertyFilter
.
filterListByProps : L3.PropertiesAPI pos -> PropertyFilter pos a -> List a -> ResultME L3Error (List a)
Filters the elements in a List
by a PropertyFilter
.
filterNonemptyByProps : L3.PropertiesAPI pos -> PropertyFilter pos a -> List.Nonempty.Nonempty a -> ResultME L3Error (List a)
Filters the elements in a Nonempty
list by a PropertyFilter
.
propertiesApiWithoutDefaults : L2 pos -> L3.PropertiesAPI pos
This makes a properties API on top of an empty set of defaults and specs.
This is useful when you don't have an L3, but want to run queries over properties. There may be intermediate properties that have been created during some processing that you need to query over, for example.