| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Unison.HashQualified
Synopsis
- data HashQualified n
- = NameOnly n
- | HashOnly ShortHash
- | HashQualified n ShortHash
- asNameOnly :: HashQualified n -> Maybe n
- stripNamespace :: Name -> HashQualified Name -> HashQualified Name
- toName :: HashQualified n -> Maybe n
- sortByLength :: [HashQualified Name] -> [HashQualified Name]
- hasName :: HashQualified Name -> Bool
- hasHash :: HashQualified Name -> Bool
- toHash :: HashQualified n -> Maybe ShortHash
- fromNameHash :: Maybe Name -> Maybe ShortHash -> HashQualified Name
- take :: Int -> HashQualified n -> HashQualified n
- toStringWith :: (n -> String) -> HashQualified n -> String
- toTextWith :: (n -> Text) -> HashQualified n -> Text
- fromNamedReferent :: n -> Referent -> HashQualified n
- fromNamedReference :: n -> Reference -> HashQualified n
- fromReferent :: Referent -> HashQualified Name
- fromReference :: Reference -> HashQualified Name
- fromPattern :: ConstructorReference -> HashQualified Name
- fromName :: n -> HashQualified n
- matchesNamedReferent :: Name -> Referent -> HashQualified Name -> Bool
- matchesNamedReference :: Name -> Reference -> HashQualified Name -> Bool
- requalify :: HashQualified Name -> Referent -> HashQualified Name
- searchBySuffix :: forall ref. Ord ref => (ref -> ShortHash) -> HashQualified Name -> Relation Name ref -> Set ref
- filterBySuffix :: forall ref. Ord ref => (ref -> ShortHash) -> HashQualified Name -> Relation Name ref -> Relation Name ref
Documentation
data HashQualified n Source #
Constructors
| NameOnly n | |
| HashOnly ShortHash | |
| HashQualified n ShortHash |
Instances
asNameOnly :: HashQualified n -> Maybe n Source #
stripNamespace :: Name -> HashQualified Name -> HashQualified Name Source #
toName :: HashQualified n -> Maybe n Source #
sortByLength :: [HashQualified Name] -> [HashQualified Name] Source #
fromNameHash :: Maybe Name -> Maybe ShortHash -> HashQualified Name Source #
take :: Int -> HashQualified n -> HashQualified n Source #
toStringWith :: (n -> String) -> HashQualified n -> String Source #
toTextWith :: (n -> Text) -> HashQualified n -> Text Source #
fromNamedReferent :: n -> Referent -> HashQualified n Source #
fromNamedReference :: n -> Reference -> HashQualified n Source #
fromReferent :: Referent -> HashQualified Name Source #
fromName :: n -> HashQualified n Source #
matchesNamedReferent :: Name -> Referent -> HashQualified Name -> Bool Source #
matchesNamedReference :: Name -> Reference -> HashQualified Name -> Bool Source #
requalify :: HashQualified Name -> Referent -> HashQualified Name Source #
searchBySuffix :: forall ref. Ord ref => (ref -> ShortHash) -> HashQualified Name -> Relation Name ref -> Set ref Source #
Like searchBySuffix, but uses a hash-qualified name to search instead.
The name *and* the hash are used to determine whether something is an exact match. For example, in namespace {foo#foo, hello.foo#bar}, searching for foo#bar will return the singleton set {hello.foo#bar}, because even though there is an exact name match on foo, its hash doesn't match so we fall back to "suffix" matches. This probably isn't a very important detail in practice, but the other possible implementation (do name-only search, *then* filter result down to matching hashes) seems worse.
filterBySuffix :: forall ref. Ord ref => (ref -> ShortHash) -> HashQualified Name -> Relation Name ref -> Relation Name ref Source #
Like searchBySuffix, but also keeps the names around.