Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Names = Names {}
- addTerm :: Name -> Referent -> Names -> Names
- addType :: Name -> TypeReference -> Names -> Names
- labeledReferences :: Names -> Set LabeledDependency
- conflicts :: Names -> Names
- contains :: Names -> Reference -> Bool
- difference :: Names -> Names -> Names
- filter :: (Name -> Bool) -> Names -> Names
- filterByHQs :: Set (HashQualified Name) -> Names -> Names
- filterBySHs :: Set ShortHash -> Names -> Names
- filterTypes :: (Name -> Bool) -> Names -> Names
- fromReferenceIds :: DefnsF (Relation Name) TermReferenceId TypeReferenceId -> Names
- fromUnconflictedReferenceIds :: DefnsF (Map Name) TermReferenceId TypeReferenceId -> Names
- map :: (Name -> Name) -> Names -> Names
- makeAbsolute :: Names -> Names
- makeRelative :: Names -> Names
- fuzzyFind :: (Name -> Text) -> [String] -> Names -> [(Alignment, Name, Set (Either Referent TypeReference))]
- hqName :: Names -> Name -> Either TypeReference Referent -> HashQualified Name
- hqTermName :: Int -> Names -> Name -> Referent -> HashQualified Name
- hqTypeName :: Int -> Names -> Name -> TypeReference -> HashQualified Name
- hqTermName' :: Int -> Name -> Referent -> HashQualified Name
- hqTypeName' :: Int -> Name -> TypeReference -> HashQualified Name
- _hqTermName :: Names -> Name -> Referent -> HashQualified Name
- _hqTypeName :: Names -> Name -> TypeReference -> HashQualified Name
- _hqTermAliases :: Names -> Name -> Referent -> Set (HashQualified Name)
- _hqTypeAliases :: Names -> Name -> TypeReference -> Set (HashQualified Name)
- mapNames :: (Name -> Name) -> Names -> Names
- prefix0 :: Name -> Names -> Names
- restrictReferences :: Set Reference -> Names -> Names
- refTermsNamed :: Names -> Name -> Set TermReference
- refTermsHQNamed :: Names -> HashQualified Name -> Set TermReference
- referenceIds :: Names -> Set Id
- termReferences :: Names -> Set TermReference
- termReferents :: Names -> Set Referent
- typeReferences :: Names -> Set TypeReference
- termsNamed :: Names -> Name -> Set Referent
- typesNamed :: Names -> Name -> Set TypeReference
- shadowing :: Names -> Names -> Names
- shadowing1 :: (Ord a, Ord b) => Relation a b -> Relation a b -> Relation a b
- preferring :: Names -> Names -> Names
- namesForReference :: Names -> TypeReference -> Set Name
- namesForReferent :: Names -> Referent -> Set Name
- shadowTerms :: [Name] -> Names -> Names
- importing :: [(Name, Name)] -> Names -> Names
- constructorsForType :: TypeReference -> Names -> [(Name, Referent)]
- expandWildcardImport :: Name -> Names -> [(Name, Name)]
- isEmpty :: Names -> Bool
- hashQualifyTypesRelation :: Relation Name TypeReference -> Relation (HashQualified Name) TypeReference
- hashQualifyTermsRelation :: Relation Name Referent -> Relation (HashQualified Name) Referent
- fromTermsAndTypes :: [(Name, Referent)] -> [(Name, TypeReference)] -> Names
- lenientToNametree :: Names -> Nametree (DefnsF (Map NameSegment) Referent TypeReference)
- resolveName :: forall ref. (Ord ref, Show ref) => Relation Name ref -> Set Name -> Name -> Set (ResolvesTo ref)
- resolveNameIncludingNames :: forall ref. (Ord ref, Show ref) => Relation Name ref -> Set Name -> Name -> Relation Name (ResolvesTo ref)
Documentation
Instances
Monoid Names Source # | |
Semigroup Names Source # | |
Generic Names Source # | |
Show Names Source # | |
Eq Names Source # | |
Ord Names Source # | |
type Rep Names Source # | |
Defined in Unison.Names type Rep Names = D1 ('MetaData "Names" "Unison.Names" "unison-core1-0.0.0-6SyLKzwOxrt37WukuFZrYQ" 'False) (C1 ('MetaCons "Names" 'PrefixI 'True) (S1 ('MetaSel ('Just "terms") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Relation Name Referent)) :*: S1 ('MetaSel ('Just "types") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Relation Name TypeReference)))) |
labeledReferences :: Names -> Set LabeledDependency Source #
Collect all references in the given Names, tagged with their type.
filterByHQs :: Set (HashQualified Name) -> Names -> Names Source #
fromReferenceIds :: DefnsF (Relation Name) TermReferenceId TypeReferenceId -> Names Source #
Construct a Names
from unconflicted reference ids.
fromUnconflictedReferenceIds :: DefnsF (Map Name) TermReferenceId TypeReferenceId -> Names Source #
Construct a Names
from unconflicted reference ids.
makeAbsolute :: Names -> Names Source #
makeRelative :: Names -> Names Source #
fuzzyFind :: (Name -> Text) -> [String] -> Names -> [(Alignment, Name, Set (Either Referent TypeReference))] Source #
hqName :: Names -> Name -> Either TypeReference Referent -> HashQualified Name Source #
Like hqTermName and hqTypeName, but considers term and type names to conflict with each other (so will hash-qualify if there is e.g. both a term and a type named "foo").
This is useful in contexts such as printing branch diffs. Example:
- Deletes:
foo foo
We want to append the hash regardless of whether or not one is a term and the other is a type.
hqTermName :: Int -> Names -> Name -> Referent -> HashQualified Name Source #
hqTypeName :: Int -> Names -> Name -> TypeReference -> HashQualified Name Source #
hqTermName' :: Int -> Name -> Referent -> HashQualified Name Source #
hqTypeName' :: Int -> Name -> TypeReference -> HashQualified Name Source #
_hqTermName :: Names -> Name -> Referent -> HashQualified Name Source #
_hqTypeName :: Names -> Name -> TypeReference -> HashQualified Name Source #
_hqTermAliases :: Names -> Name -> Referent -> Set (HashQualified Name) Source #
_hqTypeAliases :: Names -> Name -> TypeReference -> Set (HashQualified Name) Source #
prefix0 :: Name -> Names -> Names Source #
prefix0 n ns
prepends n
to each name in ns
.
Precondition: every name in ns
is relative.
refTermsNamed :: Names -> Name -> Set TermReference Source #
Get all terms with a specific name.
refTermsHQNamed :: Names -> HashQualified Name -> Set TermReference Source #
Get all terms with a specific hash-qualified name.
termReferences :: Names -> Set TermReference Source #
Returns all constructor term references. Constructors are omitted.
typeReferences :: Names -> Set TypeReference Source #
typesNamed :: Names -> Name -> Set TypeReference Source #
shadowing :: Names -> Names -> Names Source #
Construct names from a left-biased map union of the domains of the input names. That is, for each distinct name, if it refers to *any* references in the left argument, use those (ignoring the right).
This is appropriate for shadowing names in the codebase with names in a Unison file, for instance:
shadowing scratchFileNames codebaseNames
preferring :: Names -> Names -> Names Source #
Construct names from a left-biased map union of the ranges of the input names. That is, for each distinct reference, if it is referred to by *any* names in the left argument, use those (ignoring the right).
This is appropriate for biasing a PPE towards picking names in the left argument.
namesForReference :: Names -> TypeReference -> Set Name Source #
constructorsForType :: TypeReference -> Names -> [(Name, Referent)] Source #
expandWildcardImport :: Name -> Names -> [(Name, Name)] Source #
Converts a wildcard import into a list of explicit imports, of the form
[(suffix, full)]. Example: if io
contains two functions, foo
and
bar
, then `expandWildcardImport io` will produce
`[(foo, io.foo), (bar, io.bar)]`.
hashQualifyTypesRelation :: Relation Name TypeReference -> Relation (HashQualified Name) TypeReference Source #
hashQualifyTermsRelation :: Relation Name Referent -> Relation (HashQualified Name) Referent Source #
fromTermsAndTypes :: [(Name, Referent)] -> [(Name, TypeReference)] -> Names Source #
lenientToNametree :: Names -> Nametree (DefnsF (Map NameSegment) Referent TypeReference) Source #
Leniently view a Names as a NameTree
This function is "lenient" in the sense that it does not handle conflicted names with any smarts whatsoever. The resulting nametree will simply contain one of the associated references of a conflicted name - we don't specify which.
resolveName :: forall ref. (Ord ref, Show ref) => Relation Name ref -> Set Name -> Name -> Set (ResolvesTo ref) Source #
resolveNameIncludingNames :: forall ref. (Ord ref, Show ref) => Relation Name ref -> Set Name -> Name -> Relation Name (ResolvesTo ref) Source #
Like resolveName
, but include the names in the output.