Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- declTypeDependencies :: Ord v => Decl v a -> Set Reference
- typeDependencies :: Ord v => DataDeclaration v a -> Set TypeReference
- labeledTypeDependencies :: Ord v => DataDeclaration v a -> Set LabeledDependency
- labeledDeclTypeDependencies :: Ord v => Decl v a -> Set LabeledDependency
- labeledDeclDependenciesIncludingSelf :: Ord v => TypeReference -> Decl v a -> Set LabeledDependency
- labeledDeclDependenciesIncludingSelfAndFieldAccessors :: Var v => TypeReference -> Decl v a -> Set LabeledDependency
- hashFieldAccessors :: forall v a. Var v => PrettyPrintEnv -> v -> [v] -> TypeReference -> DataDeclaration v a -> Maybe (Map v (TermReferenceId, Term v (), Type v ()))
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.
labeledTypeDependencies :: Ord v => DataDeclaration v a -> Set LabeledDependency #
labeledDeclTypeDependencies :: Ord v => Decl v a -> Set LabeledDependency #
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.