unison-cli-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Cli.UpdateUtils

Description

This module contains functionality that is common to the general idea of "updating" a term in Unison, which is when we reassign a name from one hash to another and then see if all dependents still typecheck.

This occurs in the pull, merge, update, and upgrade commands.

Synopsis

Loading definitions

Getting dependents in a namespace

getNamespaceDependentsOf :: Names -> Set Reference -> Transaction (DefnsF (Relation Name) TermReferenceId TypeReferenceId) Source #

Given a namespace and a set of dependencies, return the subset of the namespace that consists of only the (transitive) dependents of the dependencies.

getNamespaceDependentsOf2 :: Defns (BiMultimap Referent Name) (BiMultimap TypeReference Name) -> Set Reference -> Transaction (DefnsF (Map Name) TermReferenceId TypeReferenceId) Source #

Given a namespace and a set of dependencies, return the subset of the namespace that consists of only the (transitive) dependents of the dependencies.

getNamespaceDependentsOf3 :: Defns (BiMultimap Referent Name) (BiMultimap TypeReference Name) -> DefnsF Set TermReference TypeReference -> Transaction (DefnsF Set TermReferenceId TypeReferenceId) Source #

Given a namespace and a set of dependencies, return the subset of the namespace that consists of only the (transitive) dependents of the dependencies.

Narrowing definitions

narrowDefns :: forall term typ. (Ord term, Ord typ) => DefnsF (Relation Name) term typ -> Either (Defn (Conflicted Name term) (Conflicted Name typ)) (Nametree (DefnsF (Map NameSegment) term typ)) Source #

Narrow a namespace that may contain conflicted names, resulting in either a failure (if we find a conflicted name), or the narrowed nametree without conflicted names.

Hydrating definitions

hydrateDefns :: forall m name term typ. (Monad m, Ord name) => (Hash -> m [term]) -> (Hash -> m [typ]) -> DefnsF (Map name) TermReferenceId TypeReferenceId -> m (DefnsF (Map name) (TermReferenceId, term) (TypeReferenceId, typ)) Source #

Hydrate termtype references to actual termstypes.

Parsing and typechecking