finos/morphir-elm/20.1.0

NOTE: the latest version is 22.0.2

Formerly Morgan-Stanley/morphir-elm. Search finds this package by either name.

Morphir.IR.Distribution

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:

  • The name of the library. This is the globally unique identifier of the package like the package name in NPM or the Group and Artifact ID in Maven.
  • All the library dependencies as a dictionary of package name and package specification. The package specification only contains type signatures, no implementations.
  • The package definition which contains all the module definitions included in the library. The package definition contains implementations as well, even ones that are not exposed.
= Library
PackageName
(Dict PackageName (Specification ()))
(Definition () (Type ()))

Type that represents a package distribution. Currently the only distribution type we provide is a Library.

Lookups

lookupModuleSpecification : PackageName -> ModuleName -> Distribution -> Maybe (Specification ())

Look up a module specification by package and module path in a distribution.

Look up a type specification by package, module and local name in a distribution.

lookupValueSpecification : FQName -> Distribution -> Maybe (Specification ())

Look up a value specification by package, module and local name in a distribution.

lookupBaseTypeName : FQName -> Distribution -> Maybe FQName

Look up the base type name following aliases by package, module and local name in a distribution.

lookupValueDefinition : FQName -> Distribution -> Maybe (Definition () (Type ()))

Look up a value definition by qualified name in a distribution. The value will only be searched in the current package.

Get the package specification of a distribution.

Get the package name of a distribution.

Get all type specifications.

FQName
-> Maybe ( FQName, List Name, List ( Name, 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:

  • The fully-qualified name of the type that this constructor belongs to.
  • The type arguments of the type.
  • The list of arguments (as name-type pairs) for this constructor.
resolveAliases : FQName -> Distribution -> FQName

Follow direct aliases until the leaf type is found.

Fully resolve all type aliases in the type.

Replace record constructors with the corresponding record value.

Updates

insertDependency : PackageName -> Specification () -> Distribution -> Distribution

Add a package specification as a dependency of this library.