Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data UFMap k v
- data UFValue k v
- = Indirection !k
- | Canonical !Int !v
- empty :: UFMap k v
- lookupCanon :: Ord k => k -> UFMap k v -> Maybe (k, Int, v, UFMap k v)
- insert :: Ord k => k -> v -> UFMap k v -> UFMap k v
- union :: forall m k v r. (MonadFix m, Ord k) => k -> k -> UFMap k v -> (UFMap k v -> m r) -> (k -> v -> UFMap k v -> m (Maybe r)) -> m (Maybe r)
- alterF :: forall f k v. (Functor f, Ord k) => k -> f (Maybe v) -> (k -> Int -> v -> f (UFValue k v)) -> UFMap k v -> f (UFMap k v)
- alter :: forall k v. Ord k => k -> Maybe v -> (k -> Int -> v -> UFValue k v) -> UFMap k v -> UFMap k v
- keys :: UFMap k v -> [k]
- toClasses :: forall k v. Ord k => UFMap k v -> [(k, Set k, v)]
Documentation
A union-find structure. Used by
NormalizedConstraints
to provide efficient unification.
Indirection !k | This is not the canonical value, lookup k in the map to try again |
Canonical !Int !v | The number of elements in the equivalence class |
Instances
(Show k, Show v) => Show (UFValue k v) Source # | |
(Eq k, Eq v) => Eq (UFValue k v) Source # | |
(Ord k, Ord v) => Ord (UFValue k v) Source # | |
Defined in Unison.PatternMatchCoverage.UFMap |
:: Ord k | |
=> k | |
-> UFMap k v | |
-> Maybe (k, Int, v, UFMap k v) | returns:
|
Lookup the canonical value
union :: forall m k v r. (MonadFix m, Ord k) => k -> k -> UFMap k v -> (UFMap k v -> m r) -> (k -> v -> UFMap k v -> m (Maybe r)) -> m (Maybe r) Source #
alterF :: forall f k v. (Functor f, Ord k) => k -> f (Maybe v) -> (k -> Int -> v -> f (UFValue k v)) -> UFMap k v -> f (UFMap k v) Source #