A distribution is a complete package of Morphir types and functions with all their dependencies.
morphir-elm make
produces a JSON that represents a Distribution
. We are planning to define different types of
distributions in the future but currently the only one is Library
. A library contains the following pieces of
information:
Type that represents a package distribution. Currently the only distribution type we provide is a Library
.
lookupModuleSpecification : Morphir.IR.Package.PackageName -> Morphir.IR.Module.ModuleName -> Distribution -> Maybe (Morphir.IR.Module.Specification ())
Look up a module specification by package and module path in a distribution.
lookupTypeSpecification : Morphir.IR.FQName.FQName -> Distribution -> Maybe (Morphir.IR.Type.Specification ())
Look up a type specification by package, module and local name in a distribution.
lookupValueSpecification : Morphir.IR.FQName.FQName -> Distribution -> Maybe (Morphir.IR.Value.Specification ())
Look up a value specification by package, module and local name in a distribution.
lookupBaseTypeName : Morphir.IR.FQName.FQName -> Distribution -> Maybe Morphir.IR.FQName.FQName
Look up the base type name following aliases by package, module and local name in a distribution.
lookupValueDefinition : Morphir.IR.FQName.FQName -> Distribution -> Maybe (Morphir.IR.Value.Definition () (Morphir.IR.Type.Type ()))
Look up a value definition by qualified name in a distribution. The value will only be searched in the current package.
lookupPackageSpecification : Distribution -> Morphir.IR.Package.Specification ()
Get the package specification of a distribution.
lookupPackageName : Distribution -> Morphir.IR.Package.PackageName
Get the package name of a distribution.
typeSpecifications : Distribution -> Dict Morphir.IR.FQName.FQName (Morphir.IR.Type.Specification ())
Get all type specifications.
lookupTypeConstructor : Morphir.IR.FQName.FQName -> Distribution -> Maybe ( Morphir.IR.FQName.FQName, List Morphir.IR.Name.Name, List ( Morphir.IR.Name.Name, Morphir.IR.Type.Type () ) )
Look up a type constructor by fully-qualified name. Dependencies will be included in the search. The function returns a tuple with the following elements:
resolveAliases : Morphir.IR.FQName.FQName -> Distribution -> Morphir.IR.FQName.FQName
Follow direct aliases until the leaf type is found.
resolveType : Morphir.IR.Type.Type () -> Distribution -> Morphir.IR.Type.Type ()
Fully resolve all type aliases in the type.
resolveRecordConstructors : Morphir.IR.Value.Value ta va -> Distribution -> Morphir.IR.Value.Value ta va
Replace record constructors with the corresponding record value.
insertDependency : Morphir.IR.Package.PackageName -> Morphir.IR.Package.Specification () -> Distribution -> Distribution
Add a package specification as a dependency of this library.