A package is collection of types and values that are versioned together. If this sounds abstract just think of any of the popular package managers you are familiar with: NPM, NuGet, Maven, pip or Cabal. What they consider a package is what this represents. A package contains modules which further group types and values.
Packages are available at two different levels of detail. A package specification only contains types that are exposed publicly and type signatures for values that are exposed publicly. A package definition contains all the details including implementation and private types and values.
{ modules : Dict Morphir.IR.Module.ModuleName (Morphir.IR.Module.Specification ta) }
Type that represents a package specification. A package specification only contains types that are exposed publicly and type signatures for values that are exposed publicly.
emptySpecification : Specification ta
Get an empty package specification with no modules.
{ modules : Dict Morphir.IR.Module.ModuleName (Morphir.IR.AccessControlled.AccessControlled (Morphir.IR.Module.Definition ta va)) }
Type that represents a package definition. A package definition contains all the details including implementation
and private types and values. The modules field is a dictionary keyed by module name that contains access controlled
module definitions. The AccessControlled
adds access classifiers to each module to differentiate public and private
modules.
emptyDefinition : Definition ta va
Get an empty package definition with no modules.
lookupModuleSpecification : Morphir.IR.Path.Path -> Specification ta -> Maybe (Morphir.IR.Module.Specification ta)
Look up a module specification by its path in a package specification.
lookupModuleDefinition : Morphir.IR.Path.Path -> Definition ta va -> Maybe (Morphir.IR.Module.Definition ta va)
Look up a module definition by its path in a package specification.
lookupTypeSpecification : Morphir.IR.Path.Path -> Morphir.IR.Name.Name -> Specification ta -> Maybe (Morphir.IR.Type.Specification ta)
Look up a type specification by its module path and name in a package specification.
lookupValueSpecification : Morphir.IR.Path.Path -> Morphir.IR.Name.Name -> Specification ta -> Maybe (Morphir.IR.Value.Specification ta)
Look up a value specification by its module path and name in a package specification.
lookupValueDefinition : Morphir.IR.Path.Path -> Morphir.IR.Name.Name -> Definition ta va -> Maybe (Morphir.IR.Value.Definition ta va)
Look up a value definition by its module path and name in a package specification.
Morphir.IR.Path.Path
A package name is a globally unique identifier for a package. It is represented by a path, which is a list of names.
definitionToSpecification : Definition ta va -> Specification ta
Turn a package definition into a package specification. Only publicly exposed modules will be included in the result.
definitionToSpecificationWithPrivate : Definition ta va -> Specification ta
Turn a package definition into a package specification. Non-exposed modules will also be included in the result.
eraseDefinitionAttributes : Definition ta va -> Definition () ()
Remove all type and value attributes from a package definition.
eraseSpecificationAttributes : Specification ta -> Specification ()
Remove all type attributes from a package specification.
mapDefinitionAttributes : (ta -> tb) -> (va -> vb) -> Definition ta va -> Definition tb vb
Map all type and value attributes of a package definition.
mapSpecificationAttributes : (ta -> tb) -> Specification ta -> Specification tb
Map all type attributes of a package specification.
selectModules : Set Morphir.IR.Module.ModuleName -> PackageName -> Definition ta va -> Definition ta va
Filter down the modules in this distribution to the specified modules and their transitive dependencies.
modulesOrderedByDependency : PackageName -> Definition () (Morphir.IR.Type.Type ()) -> Result (Morphir.Dependency.DAG.CycleDetected Morphir.IR.Module.ModuleName) (List ( Morphir.IR.Module.ModuleName, Morphir.IR.AccessControlled.AccessControlled (Morphir.IR.Module.Definition () (Morphir.IR.Type.Type ())) ))
Get the list of modules within this package ordered by dependency. If module B depends on A than module B is guaranteed to be after A in the list.