unison-parser-typechecker-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.DataDeclaration.Dependencies

Synopsis

Documentation

typeDependencies :: Ord v => DataDeclaration v a -> Set TypeReference #

All references to types mentioned in the given data declaration's fields/constructors Note: Does not include references to the constructors or the decl itself (unless the decl is self-referential) Note: Does NOT include the referents for fields and field accessors. Those must be computed separately because we need access to the typechecker to do so.

labeledDeclDependenciesIncludingSelf :: Ord v => TypeReference -> Decl v a -> Set LabeledDependency #

Compute the dependencies of a data declaration, including the type itself and references for each of its constructors.

NOTE: You may prefer labeledDeclDependenciesIncludingSelfAndFieldAccessors in Unison.DataDeclaration.Dependencies, it also includes Referents for accessors of record fields.

labeledDeclDependenciesIncludingSelfAndFieldAccessors :: Var v => TypeReference -> Decl v a -> Set LabeledDependency Source #

Generate the LabeledDependencies for everything in a Decl, including the Decl itself, all its constructors, all referenced types, and all possible record accessors.

Note that we can't actually tell whether the Decl was originally a record or not, so we include all possible accessors, but they may or may not exist in the codebase.

hashFieldAccessors :: forall v a. Var v => PrettyPrintEnv -> v -> [v] -> TypeReference -> DataDeclaration v a -> Maybe (Map v (TermReferenceId, Term v (), Type v ())) Source #

Generate Referents for all possible field accessors of a Decl.

Returns Nothing if inferring/typechecking of any accessor fails, which shouldn't normally happen, but does when record fields are higher rank, because the higher rank types can't be inferred.

See https://github.com/unisonweb/unison/issues/498