unison-core1-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Names

Synopsis

Documentation

data Names Source #

Instances

Instances details
Monoid Names Source # 
Instance details

Defined in Unison.Names

Methods

mempty :: Names #

mappend :: Names -> Names -> Names #

mconcat :: [Names] -> Names #

Semigroup Names Source # 
Instance details

Defined in Unison.Names

Methods

(<>) :: Names -> Names -> Names #

sconcat :: NonEmpty Names -> Names #

stimes :: Integral b => b -> Names -> Names #

Generic Names Source # 
Instance details

Defined in Unison.Names

Associated Types

type Rep Names :: Type -> Type #

Methods

from :: Names -> Rep Names x #

to :: Rep Names x -> Names #

Show Names Source # 
Instance details

Defined in Unison.Names

Methods

showsPrec :: Int -> Names -> ShowS #

show :: Names -> String #

showList :: [Names] -> ShowS #

Eq Names Source # 
Instance details

Defined in Unison.Names

Methods

(==) :: Names -> Names -> Bool #

(/=) :: Names -> Names -> Bool #

Ord Names Source # 
Instance details

Defined in Unison.Names

Methods

compare :: Names -> Names -> Ordering #

(<) :: Names -> Names -> Bool #

(<=) :: Names -> Names -> Bool #

(>) :: Names -> Names -> Bool #

(>=) :: Names -> Names -> Bool #

max :: Names -> Names -> Names #

min :: Names -> Names -> Names #

type Rep Names Source # 
Instance details

Defined in Unison.Names

type Rep Names = D1 ('MetaData "Names" "Unison.Names" "unison-core1-0.0.0-Kp7ZcNnt5XdB8ImvFwyntI" '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.

conflicts :: Names -> Names Source #

filters out everything from the domain except what's conflicted

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.

map :: (Name -> Name) -> Names -> Names 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.

mapNames :: (Name -> Name) -> Names -> Names Source #

Map over each name in a Names.

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.

referenceIds :: Names -> Set Id Source #

Get all (untagged) term/type references ids in a Names.

termReferences :: Names -> Set TermReference Source #

Returns all constructor term references. Constructors are omitted.

shadowing :: Names -> Names -> Names Source #

Prefer names in the first argument, falling back to names in the second. This can be used to shadow names in the codebase with names in a unison file for instance: e.g. shadowing scratchFileNames codebaseNames

importing :: [(Name, Name)] -> Names -> Names Source #

Given a mapping from name to qualified name, update a Names, so for instance if the input has [(Some, Optional.Some)], and Some is a constructor in the input Names, the alias Some will map to that same constructor and shadow anything else that is currently called Some.

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)]`.

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 => Relation Name ref -> Set Name -> Name -> Set (ResolvesTo ref) Source #