module Unison.Names.ResolvesTo ( ResolvesTo (..), partitionResolutions, ) where import Unison.Name (Name) import Unison.Prelude data ResolvesTo ref = ResolvesToNamespace ref | ResolvesToLocal Name deriving stock (ResolvesTo ref -> ResolvesTo ref -> Bool (ResolvesTo ref -> ResolvesTo ref -> Bool) -> (ResolvesTo ref -> ResolvesTo ref -> Bool) -> Eq (ResolvesTo ref) forall ref. Eq ref => ResolvesTo ref -> ResolvesTo ref -> Bool forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: forall ref. Eq ref => ResolvesTo ref -> ResolvesTo ref -> Bool == :: ResolvesTo ref -> ResolvesTo ref -> Bool $c/= :: forall ref. Eq ref => ResolvesTo ref -> ResolvesTo ref -> Bool /= :: ResolvesTo ref -> ResolvesTo ref -> Bool Eq, Eq (ResolvesTo ref) Eq (ResolvesTo ref) => (ResolvesTo ref -> ResolvesTo ref -> Ordering) -> (ResolvesTo ref -> ResolvesTo ref -> Bool) -> (ResolvesTo ref -> ResolvesTo ref -> Bool) -> (ResolvesTo ref -> ResolvesTo ref -> Bool) -> (ResolvesTo ref -> ResolvesTo ref -> Bool) -> (ResolvesTo ref -> ResolvesTo ref -> ResolvesTo ref) -> (ResolvesTo ref -> ResolvesTo ref -> ResolvesTo ref) -> Ord (ResolvesTo ref) ResolvesTo ref -> ResolvesTo ref -> Bool ResolvesTo ref -> ResolvesTo ref -> Ordering ResolvesTo ref -> ResolvesTo ref -> ResolvesTo ref forall a. Eq a => (a -> a -> Ordering) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> a) -> (a -> a -> a) -> Ord a forall ref. Ord ref => Eq (ResolvesTo ref) forall ref. Ord ref => ResolvesTo ref -> ResolvesTo ref -> Bool forall ref. Ord ref => ResolvesTo ref -> ResolvesTo ref -> Ordering forall ref. Ord ref => ResolvesTo ref -> ResolvesTo ref -> ResolvesTo ref $ccompare :: forall ref. Ord ref => ResolvesTo ref -> ResolvesTo ref -> Ordering compare :: ResolvesTo ref -> ResolvesTo ref -> Ordering $c< :: forall ref. Ord ref => ResolvesTo ref -> ResolvesTo ref -> Bool < :: ResolvesTo ref -> ResolvesTo ref -> Bool $c<= :: forall ref. Ord ref => ResolvesTo ref -> ResolvesTo ref -> Bool <= :: ResolvesTo ref -> ResolvesTo ref -> Bool $c> :: forall ref. Ord ref => ResolvesTo ref -> ResolvesTo ref -> Bool > :: ResolvesTo ref -> ResolvesTo ref -> Bool $c>= :: forall ref. Ord ref => ResolvesTo ref -> ResolvesTo ref -> Bool >= :: ResolvesTo ref -> ResolvesTo ref -> Bool $cmax :: forall ref. Ord ref => ResolvesTo ref -> ResolvesTo ref -> ResolvesTo ref max :: ResolvesTo ref -> ResolvesTo ref -> ResolvesTo ref $cmin :: forall ref. Ord ref => ResolvesTo ref -> ResolvesTo ref -> ResolvesTo ref min :: ResolvesTo ref -> ResolvesTo ref -> ResolvesTo ref Ord, Int -> ResolvesTo ref -> ShowS [ResolvesTo ref] -> ShowS ResolvesTo ref -> String (Int -> ResolvesTo ref -> ShowS) -> (ResolvesTo ref -> String) -> ([ResolvesTo ref] -> ShowS) -> Show (ResolvesTo ref) forall ref. Show ref => Int -> ResolvesTo ref -> ShowS forall ref. Show ref => [ResolvesTo ref] -> ShowS forall ref. Show ref => ResolvesTo ref -> String forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: forall ref. Show ref => Int -> ResolvesTo ref -> ShowS showsPrec :: Int -> ResolvesTo ref -> ShowS $cshow :: forall ref. Show ref => ResolvesTo ref -> String show :: ResolvesTo ref -> String $cshowList :: forall ref. Show ref => [ResolvesTo ref] -> ShowS showList :: [ResolvesTo ref] -> ShowS Show) partitionResolutions :: [(v, ResolvesTo ref)] -> ([(v, ref)], [(v, Name)]) partitionResolutions :: forall v ref. [(v, ResolvesTo ref)] -> ([(v, ref)], [(v, Name)]) partitionResolutions = [Either (v, ref) (v, Name)] -> ([(v, ref)], [(v, Name)]) forall a b. [Either a b] -> ([a], [b]) partitionEithers ([Either (v, ref) (v, Name)] -> ([(v, ref)], [(v, Name)])) -> ([(v, ResolvesTo ref)] -> [Either (v, ref) (v, Name)]) -> [(v, ResolvesTo ref)] -> ([(v, ref)], [(v, Name)]) forall b c a. (b -> c) -> (a -> b) -> a -> c . ((v, ResolvesTo ref) -> Either (v, ref) (v, Name)) -> [(v, ResolvesTo ref)] -> [Either (v, ref) (v, Name)] forall a b. (a -> b) -> [a] -> [b] map (v, ResolvesTo ref) -> Either (v, ref) (v, Name) forall {a} {b}. (a, ResolvesTo b) -> Either (a, b) (a, Name) f where f :: (a, ResolvesTo b) -> Either (a, b) (a, Name) f = \case (a v, ResolvesToNamespace b ref) -> (a, b) -> Either (a, b) (a, Name) forall a b. a -> Either a b Left (a v, b ref) (a v, ResolvesToLocal Name name) -> (a, Name) -> Either (a, b) (a, Name) forall a b. b -> Either a b Right (a v, Name name)