Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- loadNamespaceDefinitions :: forall m. Monad m => (Referent -> m Referent) -> Branch m -> m (Either (Defn (Conflicted Name Referent) (Conflicted Name TypeReference)) (Nametree (DefnsF (Map NameSegment) Referent TypeReference)))
- getNamespaceDependentsOf :: Names -> Set Reference -> Transaction (DefnsF (Relation Name) TermReferenceId TypeReferenceId)
- getNamespaceDependentsOf2 :: Defns (BiMultimap Referent Name) (BiMultimap TypeReference Name) -> Set Reference -> Transaction (DefnsF (Map Name) TermReferenceId TypeReferenceId)
- getNamespaceDependentsOf3 :: Defns (BiMultimap Referent Name) (BiMultimap TypeReference Name) -> DefnsF Set TermReference TypeReference -> Transaction (DefnsF Set TermReferenceId TypeReferenceId)
- 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))
- 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))
- parseAndTypecheck :: Pretty ColorText -> ParsingEnv Transaction -> Cli (Maybe (TypecheckedUnisonFile Symbol Ann))
Loading definitions
loadNamespaceDefinitions :: forall m. Monad m => (Referent -> m Referent) -> Branch m -> m (Either (Defn (Conflicted Name Referent) (Conflicted Name TypeReference)) (Nametree (DefnsF (Map NameSegment) Referent TypeReference))) Source #
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.