module U.Codebase.Sqlite.Patch.TypeEdit where import Control.Lens import Data.Bifoldable (Bifoldable (bifoldMap)) import Data.Bitraversable (Bitraversable (bitraverse)) import Data.Text (Text) import U.Codebase.HashTags import U.Codebase.Reference (Reference') import U.Codebase.Reference qualified as Reference import U.Codebase.Sqlite.DbId qualified as Db import U.Codebase.Sqlite.LocalIds (LocalDefnId, LocalTextId) type LocalTypeEdit = TypeEdit' LocalTextId LocalDefnId type TypeEdit = TypeEdit' Db.TextId Db.ObjectId type HashTypeEdit = TypeEdit' Text ComponentHash data TypeEdit' t h = Replace (Reference' t h) | Deprecate deriving (TypeEdit' t h -> TypeEdit' t h -> Bool (TypeEdit' t h -> TypeEdit' t h -> Bool) -> (TypeEdit' t h -> TypeEdit' t h -> Bool) -> Eq (TypeEdit' t h) forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a forall t h. (Eq t, Eq h) => TypeEdit' t h -> TypeEdit' t h -> Bool $c== :: forall t h. (Eq t, Eq h) => TypeEdit' t h -> TypeEdit' t h -> Bool == :: TypeEdit' t h -> TypeEdit' t h -> Bool $c/= :: forall t h. (Eq t, Eq h) => TypeEdit' t h -> TypeEdit' t h -> Bool /= :: TypeEdit' t h -> TypeEdit' t h -> Bool Eq, (forall a b. (a -> b) -> TypeEdit' t a -> TypeEdit' t b) -> (forall a b. a -> TypeEdit' t b -> TypeEdit' t a) -> Functor (TypeEdit' t) forall a b. a -> TypeEdit' t b -> TypeEdit' t a forall a b. (a -> b) -> TypeEdit' t a -> TypeEdit' t b forall t a b. a -> TypeEdit' t b -> TypeEdit' t a forall t a b. (a -> b) -> TypeEdit' t a -> TypeEdit' t b forall (f :: * -> *). (forall a b. (a -> b) -> f a -> f b) -> (forall a b. a -> f b -> f a) -> Functor f $cfmap :: forall t a b. (a -> b) -> TypeEdit' t a -> TypeEdit' t b fmap :: forall a b. (a -> b) -> TypeEdit' t a -> TypeEdit' t b $c<$ :: forall t a b. a -> TypeEdit' t b -> TypeEdit' t a <$ :: forall a b. a -> TypeEdit' t b -> TypeEdit' t a Functor, Eq (TypeEdit' t h) Eq (TypeEdit' t h) => (TypeEdit' t h -> TypeEdit' t h -> Ordering) -> (TypeEdit' t h -> TypeEdit' t h -> Bool) -> (TypeEdit' t h -> TypeEdit' t h -> Bool) -> (TypeEdit' t h -> TypeEdit' t h -> Bool) -> (TypeEdit' t h -> TypeEdit' t h -> Bool) -> (TypeEdit' t h -> TypeEdit' t h -> TypeEdit' t h) -> (TypeEdit' t h -> TypeEdit' t h -> TypeEdit' t h) -> Ord (TypeEdit' t h) TypeEdit' t h -> TypeEdit' t h -> Bool TypeEdit' t h -> TypeEdit' t h -> Ordering TypeEdit' t h -> TypeEdit' t h -> TypeEdit' t h 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 t h. (Ord t, Ord h) => Eq (TypeEdit' t h) forall t h. (Ord t, Ord h) => TypeEdit' t h -> TypeEdit' t h -> Bool forall t h. (Ord t, Ord h) => TypeEdit' t h -> TypeEdit' t h -> Ordering forall t h. (Ord t, Ord h) => TypeEdit' t h -> TypeEdit' t h -> TypeEdit' t h $ccompare :: forall t h. (Ord t, Ord h) => TypeEdit' t h -> TypeEdit' t h -> Ordering compare :: TypeEdit' t h -> TypeEdit' t h -> Ordering $c< :: forall t h. (Ord t, Ord h) => TypeEdit' t h -> TypeEdit' t h -> Bool < :: TypeEdit' t h -> TypeEdit' t h -> Bool $c<= :: forall t h. (Ord t, Ord h) => TypeEdit' t h -> TypeEdit' t h -> Bool <= :: TypeEdit' t h -> TypeEdit' t h -> Bool $c> :: forall t h. (Ord t, Ord h) => TypeEdit' t h -> TypeEdit' t h -> Bool > :: TypeEdit' t h -> TypeEdit' t h -> Bool $c>= :: forall t h. (Ord t, Ord h) => TypeEdit' t h -> TypeEdit' t h -> Bool >= :: TypeEdit' t h -> TypeEdit' t h -> Bool $cmax :: forall t h. (Ord t, Ord h) => TypeEdit' t h -> TypeEdit' t h -> TypeEdit' t h max :: TypeEdit' t h -> TypeEdit' t h -> TypeEdit' t h $cmin :: forall t h. (Ord t, Ord h) => TypeEdit' t h -> TypeEdit' t h -> TypeEdit' t h min :: TypeEdit' t h -> TypeEdit' t h -> TypeEdit' t h Ord, Int -> TypeEdit' t h -> ShowS [TypeEdit' t h] -> ShowS TypeEdit' t h -> String (Int -> TypeEdit' t h -> ShowS) -> (TypeEdit' t h -> String) -> ([TypeEdit' t h] -> ShowS) -> Show (TypeEdit' t h) forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a forall t h. (Show t, Show h) => Int -> TypeEdit' t h -> ShowS forall t h. (Show t, Show h) => [TypeEdit' t h] -> ShowS forall t h. (Show t, Show h) => TypeEdit' t h -> String $cshowsPrec :: forall t h. (Show t, Show h) => Int -> TypeEdit' t h -> ShowS showsPrec :: Int -> TypeEdit' t h -> ShowS $cshow :: forall t h. (Show t, Show h) => TypeEdit' t h -> String show :: TypeEdit' t h -> String $cshowList :: forall t h. (Show t, Show h) => [TypeEdit' t h] -> ShowS showList :: [TypeEdit' t h] -> ShowS Show) _Replace :: Prism (TypeEdit' t h) (TypeEdit' t' h') (Reference' t h) (Reference' t' h') _Replace :: forall t h t' h' (p :: * -> * -> *) (f :: * -> *). (Choice p, Applicative f) => p (Reference' t h) (f (Reference' t' h')) -> p (TypeEdit' t h) (f (TypeEdit' t' h')) _Replace = (Reference' t' h' -> TypeEdit' t' h') -> (TypeEdit' t h -> Either (TypeEdit' t' h') (Reference' t h)) -> Prism (TypeEdit' t h) (TypeEdit' t' h') (Reference' t h) (Reference' t' h') forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b prism Reference' t' h' -> TypeEdit' t' h' forall t h. Reference' t h -> TypeEdit' t h Replace TypeEdit' t h -> Either (TypeEdit' t' h') (Reference' t h) forall t h t' h'. TypeEdit' t h -> Either (TypeEdit' t' h') (Reference' t h) project where project :: TypeEdit' t h -> Either (TypeEdit' t' h') (Reference' t h) project :: forall t h t' h'. TypeEdit' t h -> Either (TypeEdit' t' h') (Reference' t h) project (Replace Reference' t h ref) = Reference' t h -> Either (TypeEdit' t' h') (Reference' t h) forall a b. b -> Either a b Right Reference' t h ref project TypeEdit' t h Deprecate = TypeEdit' t' h' -> Either (TypeEdit' t' h') (Reference' t h) forall a b. a -> Either a b Left TypeEdit' t' h' forall t h. TypeEdit' t h Deprecate h_ :: Traversal (TypeEdit' t h) (TypeEdit' t h') h h' h_ :: forall t h h' (f :: * -> *). Applicative f => (h -> f h') -> TypeEdit' t h -> f (TypeEdit' t h') h_ = (Reference' t h -> f (Reference' t h')) -> TypeEdit' t h -> f (TypeEdit' t h') forall t h t' h' (p :: * -> * -> *) (f :: * -> *). (Choice p, Applicative f) => p (Reference' t h) (f (Reference' t' h')) -> p (TypeEdit' t h) (f (TypeEdit' t' h')) _Replace ((Reference' t h -> f (Reference' t h')) -> TypeEdit' t h -> f (TypeEdit' t h')) -> ((h -> f h') -> Reference' t h -> f (Reference' t h')) -> (h -> f h') -> TypeEdit' t h -> f (TypeEdit' t h') forall b c a. (b -> c) -> (a -> b) -> a -> c . (h -> f h') -> Reference' t h -> f (Reference' t h') forall t h h' (f :: * -> *). Applicative f => (h -> f h') -> Reference' t h -> f (Reference' t h') Reference.h_ instance Bifunctor TypeEdit' where bimap :: forall a b c d. (a -> b) -> (c -> d) -> TypeEdit' a c -> TypeEdit' b d bimap a -> b f c -> d g (Replace Reference' a c r) = Reference' b d -> TypeEdit' b d forall t h. Reference' t h -> TypeEdit' t h Replace ((a -> b) -> (c -> d) -> Reference' a c -> Reference' b d forall a b c d. (a -> b) -> (c -> d) -> Reference' a c -> Reference' b d forall (p :: * -> * -> *) a b c d. Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d bimap a -> b f c -> d g Reference' a c r) bimap a -> b _ c -> d _ TypeEdit' a c Deprecate = TypeEdit' b d forall t h. TypeEdit' t h Deprecate instance Bifoldable TypeEdit' where bifoldMap :: forall m a b. Monoid m => (a -> m) -> (b -> m) -> TypeEdit' a b -> m bifoldMap a -> m f b -> m g (Replace Reference' a b r) = (a -> m) -> (b -> m) -> Reference' a b -> m forall m a b. Monoid m => (a -> m) -> (b -> m) -> Reference' a b -> m forall (p :: * -> * -> *) m a b. (Bifoldable p, Monoid m) => (a -> m) -> (b -> m) -> p a b -> m bifoldMap a -> m f b -> m g Reference' a b r bifoldMap a -> m _ b -> m _ TypeEdit' a b Deprecate = m forall a. Monoid a => a mempty instance Bitraversable TypeEdit' where bitraverse :: forall (f :: * -> *) a c b d. Applicative f => (a -> f c) -> (b -> f d) -> TypeEdit' a b -> f (TypeEdit' c d) bitraverse a -> f c f b -> f d g (Replace Reference' a b r) = Reference' c d -> TypeEdit' c d forall t h. Reference' t h -> TypeEdit' t h Replace (Reference' c d -> TypeEdit' c d) -> f (Reference' c d) -> f (TypeEdit' c d) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> (a -> f c) -> (b -> f d) -> Reference' a b -> f (Reference' c d) forall (f :: * -> *) a c b d. Applicative f => (a -> f c) -> (b -> f d) -> Reference' a b -> f (Reference' c d) forall (t :: * -> * -> *) (f :: * -> *) a c b d. (Bitraversable t, Applicative f) => (a -> f c) -> (b -> f d) -> t a b -> f (t c d) bitraverse a -> f c f b -> f d g Reference' a b r bitraverse a -> f c _ b -> f d _ TypeEdit' a b Deprecate = TypeEdit' c d -> f (TypeEdit' c d) forall a. a -> f a forall (f :: * -> *) a. Applicative f => a -> f a pure TypeEdit' c d forall t h. TypeEdit' t h Deprecate