{-# LANGUAGE DeriveDataTypeable #-}
module Data.Generics.Uniplate.Data.Instances(
Hide(..), Trigger(..), Invariant(..),
Map, fromMap, toMap,
Set, fromSet, toSet,
IntMap, fromIntMap, toIntMap,
IntSet, fromIntSet, toIntSet
) where
import Data.Data
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Data.IntMap as IntMap
import qualified Data.IntSet as IntSet
newtype Hide a = Hide {Hide a -> a
fromHide :: a}
deriving (ReadPrec [Hide a]
ReadPrec (Hide a)
Int -> ReadS (Hide a)
ReadS [Hide a]
(Int -> ReadS (Hide a))
-> ReadS [Hide a]
-> ReadPrec (Hide a)
-> ReadPrec [Hide a]
-> Read (Hide a)
forall a. Read a => ReadPrec [Hide a]
forall a. Read a => ReadPrec (Hide a)
forall a. Read a => Int -> ReadS (Hide a)
forall a. Read a => ReadS [Hide a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Hide a]
$creadListPrec :: forall a. Read a => ReadPrec [Hide a]
readPrec :: ReadPrec (Hide a)
$creadPrec :: forall a. Read a => ReadPrec (Hide a)
readList :: ReadS [Hide a]
$creadList :: forall a. Read a => ReadS [Hide a]
readsPrec :: Int -> ReadS (Hide a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Hide a)
Read,Eq (Hide a)
Eq (Hide a)
-> (Hide a -> Hide a -> Ordering)
-> (Hide a -> Hide a -> Bool)
-> (Hide a -> Hide a -> Bool)
-> (Hide a -> Hide a -> Bool)
-> (Hide a -> Hide a -> Bool)
-> (Hide a -> Hide a -> Hide a)
-> (Hide a -> Hide a -> Hide a)
-> Ord (Hide a)
Hide a -> Hide a -> Bool
Hide a -> Hide a -> Ordering
Hide a -> Hide a -> Hide a
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 a. Ord a => Eq (Hide a)
forall a. Ord a => Hide a -> Hide a -> Bool
forall a. Ord a => Hide a -> Hide a -> Ordering
forall a. Ord a => Hide a -> Hide a -> Hide a
min :: Hide a -> Hide a -> Hide a
$cmin :: forall a. Ord a => Hide a -> Hide a -> Hide a
max :: Hide a -> Hide a -> Hide a
$cmax :: forall a. Ord a => Hide a -> Hide a -> Hide a
>= :: Hide a -> Hide a -> Bool
$c>= :: forall a. Ord a => Hide a -> Hide a -> Bool
> :: Hide a -> Hide a -> Bool
$c> :: forall a. Ord a => Hide a -> Hide a -> Bool
<= :: Hide a -> Hide a -> Bool
$c<= :: forall a. Ord a => Hide a -> Hide a -> Bool
< :: Hide a -> Hide a -> Bool
$c< :: forall a. Ord a => Hide a -> Hide a -> Bool
compare :: Hide a -> Hide a -> Ordering
$ccompare :: forall a. Ord a => Hide a -> Hide a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (Hide a)
Ord,Hide a -> Hide a -> Bool
(Hide a -> Hide a -> Bool)
-> (Hide a -> Hide a -> Bool) -> Eq (Hide a)
forall a. Eq a => Hide a -> Hide a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Hide a -> Hide a -> Bool
$c/= :: forall a. Eq a => Hide a -> Hide a -> Bool
== :: Hide a -> Hide a -> Bool
$c== :: forall a. Eq a => Hide a -> Hide a -> Bool
Eq,Typeable)
instance Show a => Show (Hide a) where
show :: Hide a -> String
show (Hide a
a) = String
"Hide " String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
a
instance Functor Hide where
fmap :: (a -> b) -> Hide a -> Hide b
fmap a -> b
f (Hide a
x) = b -> Hide b
forall a. a -> Hide a
Hide (b -> Hide b) -> b -> Hide b
forall a b. (a -> b) -> a -> b
$ a -> b
f a
x
instance Typeable a => Data (Hide a) where
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Hide a -> c (Hide a)
gfoldl forall d b. Data d => c (d -> b) -> d -> c b
k forall g. g -> c g
z Hide a
x = Hide a -> c (Hide a)
forall g. g -> c g
z Hide a
x
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Hide a)
gunfold forall b r. Data b => c (b -> r) -> c r
k forall r. r -> c r
z Constr
c = String -> c (Hide a)
forall a. HasCallStack => String -> a
error String
"Data.Generics.Uniplate.Data.Instances.Hide: gunfold not implemented - data type has no constructors"
toConstr :: Hide a -> Constr
toConstr Hide a
_ = String -> Constr
forall a. HasCallStack => String -> a
error String
"Data.Generics.Uniplate.Data.Instances.Hide: toConstr not implemented - data type has no constructors"
dataTypeOf :: Hide a -> DataType
dataTypeOf Hide a
_ = DataType
tyHide
tyHide :: DataType
tyHide = String -> [Constr] -> DataType
mkDataType String
"Data.Generics.Uniplate.Data.Instances.Hide" []
data Trigger a = Trigger {Trigger a -> Bool
trigger :: Bool, Trigger a -> a
fromTrigger :: a}
deriving (ReadPrec [Trigger a]
ReadPrec (Trigger a)
Int -> ReadS (Trigger a)
ReadS [Trigger a]
(Int -> ReadS (Trigger a))
-> ReadS [Trigger a]
-> ReadPrec (Trigger a)
-> ReadPrec [Trigger a]
-> Read (Trigger a)
forall a. Read a => ReadPrec [Trigger a]
forall a. Read a => ReadPrec (Trigger a)
forall a. Read a => Int -> ReadS (Trigger a)
forall a. Read a => ReadS [Trigger a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Trigger a]
$creadListPrec :: forall a. Read a => ReadPrec [Trigger a]
readPrec :: ReadPrec (Trigger a)
$creadPrec :: forall a. Read a => ReadPrec (Trigger a)
readList :: ReadS [Trigger a]
$creadList :: forall a. Read a => ReadS [Trigger a]
readsPrec :: Int -> ReadS (Trigger a)
$creadsPrec :: forall a. Read a => Int -> ReadS (Trigger a)
Read,Eq (Trigger a)
Eq (Trigger a)
-> (Trigger a -> Trigger a -> Ordering)
-> (Trigger a -> Trigger a -> Bool)
-> (Trigger a -> Trigger a -> Bool)
-> (Trigger a -> Trigger a -> Bool)
-> (Trigger a -> Trigger a -> Bool)
-> (Trigger a -> Trigger a -> Trigger a)
-> (Trigger a -> Trigger a -> Trigger a)
-> Ord (Trigger a)
Trigger a -> Trigger a -> Bool
Trigger a -> Trigger a -> Ordering
Trigger a -> Trigger a -> Trigger a
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 a. Ord a => Eq (Trigger a)
forall a. Ord a => Trigger a -> Trigger a -> Bool
forall a. Ord a => Trigger a -> Trigger a -> Ordering
forall a. Ord a => Trigger a -> Trigger a -> Trigger a
min :: Trigger a -> Trigger a -> Trigger a
$cmin :: forall a. Ord a => Trigger a -> Trigger a -> Trigger a
max :: Trigger a -> Trigger a -> Trigger a
$cmax :: forall a. Ord a => Trigger a -> Trigger a -> Trigger a
>= :: Trigger a -> Trigger a -> Bool
$c>= :: forall a. Ord a => Trigger a -> Trigger a -> Bool
> :: Trigger a -> Trigger a -> Bool
$c> :: forall a. Ord a => Trigger a -> Trigger a -> Bool
<= :: Trigger a -> Trigger a -> Bool
$c<= :: forall a. Ord a => Trigger a -> Trigger a -> Bool
< :: Trigger a -> Trigger a -> Bool
$c< :: forall a. Ord a => Trigger a -> Trigger a -> Bool
compare :: Trigger a -> Trigger a -> Ordering
$ccompare :: forall a. Ord a => Trigger a -> Trigger a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (Trigger a)
Ord,Trigger a -> Trigger a -> Bool
(Trigger a -> Trigger a -> Bool)
-> (Trigger a -> Trigger a -> Bool) -> Eq (Trigger a)
forall a. Eq a => Trigger a -> Trigger a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Trigger a -> Trigger a -> Bool
$c/= :: forall a. Eq a => Trigger a -> Trigger a -> Bool
== :: Trigger a -> Trigger a -> Bool
$c== :: forall a. Eq a => Trigger a -> Trigger a -> Bool
Eq,Int -> Trigger a -> ShowS
[Trigger a] -> ShowS
Trigger a -> String
(Int -> Trigger a -> ShowS)
-> (Trigger a -> String)
-> ([Trigger a] -> ShowS)
-> Show (Trigger a)
forall a. Show a => Int -> Trigger a -> ShowS
forall a. Show a => [Trigger a] -> ShowS
forall a. Show a => Trigger a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Trigger a] -> ShowS
$cshowList :: forall a. Show a => [Trigger a] -> ShowS
show :: Trigger a -> String
$cshow :: forall a. Show a => Trigger a -> String
showsPrec :: Int -> Trigger a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> Trigger a -> ShowS
Show,Typeable)
instance Functor Trigger where
fmap :: (a -> b) -> Trigger a -> Trigger b
fmap a -> b
f (Trigger Bool
a a
b) = Bool -> b -> Trigger b
forall a. Bool -> a -> Trigger a
Trigger Bool
a (b -> Trigger b) -> b -> Trigger b
forall a b. (a -> b) -> a -> b
$ a -> b
f a
b
instance (Data a, Typeable a) => Data (Trigger a) where
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Trigger a -> c (Trigger a)
gfoldl forall d b. Data d => c (d -> b) -> d -> c b
k forall g. g -> c g
z (Trigger Bool
_ a
x) = (a -> Trigger a) -> c (a -> Trigger a)
forall g. g -> c g
z (Bool -> a -> Trigger a
forall a. Bool -> a -> Trigger a
Trigger Bool
True) c (a -> Trigger a) -> a -> c (Trigger a)
forall d b. Data d => c (d -> b) -> d -> c b
`k` a
x
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Trigger a)
gunfold forall b r. Data b => c (b -> r) -> c r
k forall r. r -> c r
z Constr
c = c (a -> Trigger a) -> c (Trigger a)
forall b r. Data b => c (b -> r) -> c r
k (c (a -> Trigger a) -> c (Trigger a))
-> c (a -> Trigger a) -> c (Trigger a)
forall a b. (a -> b) -> a -> b
$ (a -> Trigger a) -> c (a -> Trigger a)
forall r. r -> c r
z ((a -> Trigger a) -> c (a -> Trigger a))
-> (a -> Trigger a) -> c (a -> Trigger a)
forall a b. (a -> b) -> a -> b
$ Bool -> a -> Trigger a
forall a. Bool -> a -> Trigger a
Trigger Bool
True
toConstr :: Trigger a -> Constr
toConstr Trigger{} = Constr
conTrigger
dataTypeOf :: Trigger a -> DataType
dataTypeOf Trigger a
_ = DataType
tyTrigger
conTrigger :: Constr
conTrigger = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
tyTrigger String
"Trigger" [] Fixity
Prefix
tyTrigger :: DataType
tyTrigger = String -> [Constr] -> DataType
mkDataType String
"Data.Generics.Uniplate.Data.Instances.Trigger" [Constr
conTrigger]
data Invariant a = Invariant {Invariant a -> a -> a
invariant :: a -> a, Invariant a -> a
fromInvariant :: a}
deriving Typeable
instance Show a => Show (Invariant a) where
show :: Invariant a -> String
show (Invariant a -> a
_ a
x) = String
"Invariant " String -> ShowS
forall a. [a] -> [a] -> [a]
++ a -> String
forall a. Show a => a -> String
show a
x
instance (Data a, Typeable a) => Data (Invariant a) where
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Invariant a -> c (Invariant a)
gfoldl forall d b. Data d => c (d -> b) -> d -> c b
k forall g. g -> c g
z (Invariant a -> a
f a
x) = (a -> Invariant a) -> c (a -> Invariant a)
forall g. g -> c g
z ((a -> a) -> a -> Invariant a
forall a. (a -> a) -> a -> Invariant a
Invariant a -> a
f (a -> Invariant a) -> (a -> a) -> a -> Invariant a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a
f) c (a -> Invariant a) -> a -> c (Invariant a)
forall d b. Data d => c (d -> b) -> d -> c b
`k` a
x
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Invariant a)
gunfold forall b r. Data b => c (b -> r) -> c r
k forall r. r -> c r
z Constr
c = c (a -> Invariant a) -> c (Invariant a)
forall b r. Data b => c (b -> r) -> c r
k (c (a -> Invariant a) -> c (Invariant a))
-> c (a -> Invariant a) -> c (Invariant a)
forall a b. (a -> b) -> a -> b
$ (a -> Invariant a) -> c (a -> Invariant a)
forall r. r -> c r
z ((a -> Invariant a) -> c (a -> Invariant a))
-> (a -> Invariant a) -> c (a -> Invariant a)
forall a b. (a -> b) -> a -> b
$ \a
x -> (a -> a) -> a -> Invariant a
forall a. (a -> a) -> a -> Invariant a
Invariant (String -> a -> a
forall a. HasCallStack => String -> a
error String
msg) (String -> a
forall a. HasCallStack => String -> a
error String
msg a -> a -> a
forall a. a -> a -> a
`asTypeOf` a
x)
where msg :: String
msg = String
"Data.Generics.Uniplate.Data.Instances.Invariant: gunfold only partially implemented"
toConstr :: Invariant a -> Constr
toConstr Invariant{} = Constr
conInvariant
dataTypeOf :: Invariant a -> DataType
dataTypeOf Invariant a
_ = DataType
tyInvariant
conInvariant :: Constr
conInvariant = DataType -> String -> [String] -> Fixity -> Constr
mkConstr DataType
tyInvariant String
"Invariant" [] Fixity
Prefix
tyInvariant :: DataType
tyInvariant = String -> [Constr] -> DataType
mkDataType String
"Data.Generics.Uniplate.Data.Instances.Invariant" [Constr
conInvariant]
newtype Map k v = Map (Invariant (Trigger [k], Trigger [v], Hide (Map.Map k v)))
deriving (Typeable (Map k v)
DataType
Constr
Typeable (Map k v)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Map k v -> c (Map k v))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Map k v))
-> (Map k v -> Constr)
-> (Map k v -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Map k v)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Map k v)))
-> ((forall b. Data b => b -> b) -> Map k v -> Map k v)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Map k v -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Map k v -> r)
-> (forall u. (forall d. Data d => d -> u) -> Map k v -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Map k v -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Map k v -> m (Map k v))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Map k v -> m (Map k v))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Map k v -> m (Map k v))
-> Data (Map k v)
Map k v -> DataType
Map k v -> Constr
(forall b. Data b => b -> b) -> Map k v -> Map k v
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Map k v -> c (Map k v)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Map k v)
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Map k v))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Map k v -> u
forall u. (forall d. Data d => d -> u) -> Map k v -> [u]
forall k v. (Data k, Data v) => Typeable (Map k v)
forall k v. (Data k, Data v) => Map k v -> DataType
forall k v. (Data k, Data v) => Map k v -> Constr
forall k v.
(Data k, Data v) =>
(forall b. Data b => b -> b) -> Map k v -> Map k v
forall k v u.
(Data k, Data v) =>
Int -> (forall d. Data d => d -> u) -> Map k v -> u
forall k v u.
(Data k, Data v) =>
(forall d. Data d => d -> u) -> Map k v -> [u]
forall k v r r'.
(Data k, Data v) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Map k v -> r
forall k v r r'.
(Data k, Data v) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Map k v -> r
forall k v (m :: * -> *).
(Data k, Data v, Monad m) =>
(forall d. Data d => d -> m d) -> Map k v -> m (Map k v)
forall k v (m :: * -> *).
(Data k, Data v, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Map k v -> m (Map k v)
forall k v (c :: * -> *).
(Data k, Data v) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Map k v)
forall k v (c :: * -> *).
(Data k, Data v) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Map k v -> c (Map k v)
forall k v (t :: * -> *) (c :: * -> *).
(Data k, Data v, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Map k v))
forall k v (t :: * -> * -> *) (c :: * -> *).
(Data k, Data v, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Map k v))
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Map k v -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Map k v -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Map k v -> m (Map k v)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Map k v -> m (Map k v)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Map k v)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Map k v -> c (Map k v)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Map k v))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Map k v))
$cMap :: Constr
$tMap :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Map k v -> m (Map k v)
$cgmapMo :: forall k v (m :: * -> *).
(Data k, Data v, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Map k v -> m (Map k v)
gmapMp :: (forall d. Data d => d -> m d) -> Map k v -> m (Map k v)
$cgmapMp :: forall k v (m :: * -> *).
(Data k, Data v, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Map k v -> m (Map k v)
gmapM :: (forall d. Data d => d -> m d) -> Map k v -> m (Map k v)
$cgmapM :: forall k v (m :: * -> *).
(Data k, Data v, Monad m) =>
(forall d. Data d => d -> m d) -> Map k v -> m (Map k v)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Map k v -> u
$cgmapQi :: forall k v u.
(Data k, Data v) =>
Int -> (forall d. Data d => d -> u) -> Map k v -> u
gmapQ :: (forall d. Data d => d -> u) -> Map k v -> [u]
$cgmapQ :: forall k v u.
(Data k, Data v) =>
(forall d. Data d => d -> u) -> Map k v -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Map k v -> r
$cgmapQr :: forall k v r r'.
(Data k, Data v) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Map k v -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Map k v -> r
$cgmapQl :: forall k v r r'.
(Data k, Data v) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Map k v -> r
gmapT :: (forall b. Data b => b -> b) -> Map k v -> Map k v
$cgmapT :: forall k v.
(Data k, Data v) =>
(forall b. Data b => b -> b) -> Map k v -> Map k v
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Map k v))
$cdataCast2 :: forall k v (t :: * -> * -> *) (c :: * -> *).
(Data k, Data v, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Map k v))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Map k v))
$cdataCast1 :: forall k v (t :: * -> *) (c :: * -> *).
(Data k, Data v, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Map k v))
dataTypeOf :: Map k v -> DataType
$cdataTypeOf :: forall k v. (Data k, Data v) => Map k v -> DataType
toConstr :: Map k v -> Constr
$ctoConstr :: forall k v. (Data k, Data v) => Map k v -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Map k v)
$cgunfold :: forall k v (c :: * -> *).
(Data k, Data v) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Map k v)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Map k v -> c (Map k v)
$cgfoldl :: forall k v (c :: * -> *).
(Data k, Data v) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Map k v -> c (Map k v)
$cp1Data :: forall k v. (Data k, Data v) => Typeable (Map k v)
Data, Typeable)
instance (Show k, Show v) => Show (Map k v) where; show :: Map k v -> String
show = Map k v -> String
forall a. Show a => a -> String
show (Map k v -> String) -> (Map k v -> Map k v) -> Map k v -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Map k v -> Map k v
forall k v. Map k v -> Map k v
fromMap
instance (Eq k, Eq v) => Eq (Map k v) where; Map k v
a == :: Map k v -> Map k v -> Bool
== Map k v
b = Map k v -> Map k v
forall k v. Map k v -> Map k v
fromMap Map k v
a Map k v -> Map k v -> Bool
forall a. Eq a => a -> a -> Bool
== Map k v -> Map k v
forall k v. Map k v -> Map k v
fromMap Map k v
b
instance (Ord k, Ord v) => Ord (Map k v) where; compare :: Map k v -> Map k v -> Ordering
compare Map k v
a Map k v
b = Map k v -> Map k v -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Map k v -> Map k v
forall k v. Map k v -> Map k v
fromMap Map k v
a) (Map k v -> Map k v
forall k v. Map k v -> Map k v
fromMap Map k v
b)
fromMap :: Map k v -> Map.Map k v
fromMap :: Map k v -> Map k v
fromMap (Map (Invariant (Trigger [k], Trigger [v], Hide (Map k v))
-> (Trigger [k], Trigger [v], Hide (Map k v))
_ (Trigger [k]
_,Trigger [v]
_,Hide Map k v
x))) = Map k v
x
toMap :: Ord k => Map.Map k v -> Map k v
toMap :: Map k v -> Map k v
toMap Map k v
x = Invariant (Trigger [k], Trigger [v], Hide (Map k v)) -> Map k v
forall k v.
Invariant (Trigger [k], Trigger [v], Hide (Map k v)) -> Map k v
Map (Invariant (Trigger [k], Trigger [v], Hide (Map k v)) -> Map k v)
-> Invariant (Trigger [k], Trigger [v], Hide (Map k v)) -> Map k v
forall a b. (a -> b) -> a -> b
$ ((Trigger [k], Trigger [v], Hide (Map k v))
-> (Trigger [k], Trigger [v], Hide (Map k v)))
-> (Trigger [k], Trigger [v], Hide (Map k v))
-> Invariant (Trigger [k], Trigger [v], Hide (Map k v))
forall a. (a -> a) -> a -> Invariant a
Invariant (Trigger [k], Trigger [v], Hide (Map k v))
-> (Trigger [k], Trigger [v], Hide (Map k v))
forall a b.
Ord a =>
(Trigger [a], Trigger [b], Hide (Map a b))
-> (Trigger [a], Trigger [b], Hide (Map a b))
inv ((Trigger [k], Trigger [v], Hide (Map k v))
-> Invariant (Trigger [k], Trigger [v], Hide (Map k v)))
-> (Trigger [k], Trigger [v], Hide (Map k v))
-> Invariant (Trigger [k], Trigger [v], Hide (Map k v))
forall a b. (a -> b) -> a -> b
$ Map k v -> (Trigger [k], Trigger [v], Hide (Map k v))
forall a b. Map a b -> (Trigger [a], Trigger [b], Hide (Map a b))
create Map k v
x
where
create :: Map a b -> (Trigger [a], Trigger [b], Hide (Map a b))
create Map a b
x = (Bool -> [a] -> Trigger [a]
forall a. Bool -> a -> Trigger a
Trigger Bool
False [a]
ks, Bool -> [b] -> Trigger [b]
forall a. Bool -> a -> Trigger a
Trigger Bool
False [b]
vs, Map a b -> Hide (Map a b)
forall a. a -> Hide a
Hide Map a b
x)
where ([a]
ks,[b]
vs) = [(a, b)] -> ([a], [b])
forall a b. [(a, b)] -> ([a], [b])
unzip ([(a, b)] -> ([a], [b])) -> [(a, b)] -> ([a], [b])
forall a b. (a -> b) -> a -> b
$ Map a b -> [(a, b)]
forall k a. Map k a -> [(k, a)]
Map.toAscList Map a b
x
inv :: (Trigger [a], Trigger [b], Hide (Map a b))
-> (Trigger [a], Trigger [b], Hide (Map a b))
inv (Trigger [a]
ks,Trigger [b]
vs,Hide (Map a b)
x)
| Trigger [a] -> Bool
forall a. Trigger a -> Bool
trigger Trigger [a]
ks = Map a b -> (Trigger [a], Trigger [b], Hide (Map a b))
forall a b. Map a b -> (Trigger [a], Trigger [b], Hide (Map a b))
create (Map a b -> (Trigger [a], Trigger [b], Hide (Map a b)))
-> Map a b -> (Trigger [a], Trigger [b], Hide (Map a b))
forall a b. (a -> b) -> a -> b
$ [(a, b)] -> Map a b
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList ([(a, b)] -> Map a b) -> [(a, b)] -> Map a b
forall a b. (a -> b) -> a -> b
$ [a] -> [b] -> [(a, b)]
forall a b. [a] -> [b] -> [(a, b)]
zip (Trigger [a] -> [a]
forall a. Trigger a -> a
fromTrigger Trigger [a]
ks) (Trigger [b] -> [b]
forall a. Trigger a -> a
fromTrigger Trigger [b]
vs)
| Trigger [b] -> Bool
forall a. Trigger a -> Bool
trigger Trigger [b]
vs = Map a b -> (Trigger [a], Trigger [b], Hide (Map a b))
forall a b. Map a b -> (Trigger [a], Trigger [b], Hide (Map a b))
create (Map a b -> (Trigger [a], Trigger [b], Hide (Map a b)))
-> Map a b -> (Trigger [a], Trigger [b], Hide (Map a b))
forall a b. (a -> b) -> a -> b
$ [(a, b)] -> Map a b
forall k a. [(k, a)] -> Map k a
Map.fromDistinctAscList ([(a, b)] -> Map a b) -> [(a, b)] -> Map a b
forall a b. (a -> b) -> a -> b
$ [a] -> [b] -> [(a, b)]
forall a b. [a] -> [b] -> [(a, b)]
zip (Trigger [a] -> [a]
forall a. Trigger a -> a
fromTrigger Trigger [a]
ks) (Trigger [b] -> [b]
forall a. Trigger a -> a
fromTrigger Trigger [b]
vs)
| Bool
otherwise = (Trigger [a]
ks,Trigger [b]
vs,Hide (Map a b)
x)
newtype Set k = Set (Invariant (Trigger [k], Hide (Set.Set k)))
deriving (Typeable (Set k)
DataType
Constr
Typeable (Set k)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Set k -> c (Set k))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Set k))
-> (Set k -> Constr)
-> (Set k -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Set k)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set k)))
-> ((forall b. Data b => b -> b) -> Set k -> Set k)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set k -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set k -> r)
-> (forall u. (forall d. Data d => d -> u) -> Set k -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Set k -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Set k -> m (Set k))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Set k -> m (Set k))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Set k -> m (Set k))
-> Data (Set k)
Set k -> DataType
Set k -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Set k))
(forall b. Data b => b -> b) -> Set k -> Set k
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Set k -> c (Set k)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Set k)
forall k. Data k => Typeable (Set k)
forall k. Data k => Set k -> DataType
forall k. Data k => Set k -> Constr
forall k. Data k => (forall b. Data b => b -> b) -> Set k -> Set k
forall k u.
Data k =>
Int -> (forall d. Data d => d -> u) -> Set k -> u
forall k u. Data k => (forall d. Data d => d -> u) -> Set k -> [u]
forall k r r'.
Data k =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set k -> r
forall k r r'.
Data k =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set k -> r
forall k (m :: * -> *).
(Data k, Monad m) =>
(forall d. Data d => d -> m d) -> Set k -> m (Set k)
forall k (m :: * -> *).
(Data k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Set k -> m (Set k)
forall k (c :: * -> *).
Data k =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Set k)
forall k (c :: * -> *).
Data k =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Set k -> c (Set k)
forall k (t :: * -> *) (c :: * -> *).
(Data k, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Set k))
forall k (t :: * -> * -> *) (c :: * -> *).
(Data k, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set k))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Set k -> u
forall u. (forall d. Data d => d -> u) -> Set k -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set k -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set k -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Set k -> m (Set k)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Set k -> m (Set k)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Set k)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Set k -> c (Set k)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Set k))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set k))
$cSet :: Constr
$tSet :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Set k -> m (Set k)
$cgmapMo :: forall k (m :: * -> *).
(Data k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Set k -> m (Set k)
gmapMp :: (forall d. Data d => d -> m d) -> Set k -> m (Set k)
$cgmapMp :: forall k (m :: * -> *).
(Data k, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Set k -> m (Set k)
gmapM :: (forall d. Data d => d -> m d) -> Set k -> m (Set k)
$cgmapM :: forall k (m :: * -> *).
(Data k, Monad m) =>
(forall d. Data d => d -> m d) -> Set k -> m (Set k)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Set k -> u
$cgmapQi :: forall k u.
Data k =>
Int -> (forall d. Data d => d -> u) -> Set k -> u
gmapQ :: (forall d. Data d => d -> u) -> Set k -> [u]
$cgmapQ :: forall k u. Data k => (forall d. Data d => d -> u) -> Set k -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set k -> r
$cgmapQr :: forall k r r'.
Data k =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Set k -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set k -> r
$cgmapQl :: forall k r r'.
Data k =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Set k -> r
gmapT :: (forall b. Data b => b -> b) -> Set k -> Set k
$cgmapT :: forall k. Data k => (forall b. Data b => b -> b) -> Set k -> Set k
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set k))
$cdataCast2 :: forall k (t :: * -> * -> *) (c :: * -> *).
(Data k, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Set k))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Set k))
$cdataCast1 :: forall k (t :: * -> *) (c :: * -> *).
(Data k, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Set k))
dataTypeOf :: Set k -> DataType
$cdataTypeOf :: forall k. Data k => Set k -> DataType
toConstr :: Set k -> Constr
$ctoConstr :: forall k. Data k => Set k -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Set k)
$cgunfold :: forall k (c :: * -> *).
Data k =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Set k)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Set k -> c (Set k)
$cgfoldl :: forall k (c :: * -> *).
Data k =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Set k -> c (Set k)
$cp1Data :: forall k. Data k => Typeable (Set k)
Data, Typeable)
instance Show k => Show (Set k) where; show :: Set k -> String
show = Set k -> String
forall a. Show a => a -> String
show (Set k -> String) -> (Set k -> Set k) -> Set k -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Set k -> Set k
forall k. Set k -> Set k
fromSet
instance Eq k => Eq (Set k) where; Set k
a == :: Set k -> Set k -> Bool
== Set k
b = Set k -> Set k
forall k. Set k -> Set k
fromSet Set k
a Set k -> Set k -> Bool
forall a. Eq a => a -> a -> Bool
== Set k -> Set k
forall k. Set k -> Set k
fromSet Set k
b
instance Ord k => Ord (Set k) where; compare :: Set k -> Set k -> Ordering
compare Set k
a Set k
b = Set k -> Set k -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (Set k -> Set k
forall k. Set k -> Set k
fromSet Set k
a) (Set k -> Set k
forall k. Set k -> Set k
fromSet Set k
b)
fromSet :: Set k -> Set.Set k
fromSet :: Set k -> Set k
fromSet (Set (Invariant (Trigger [k], Hide (Set k)) -> (Trigger [k], Hide (Set k))
_ (Trigger [k]
_,Hide Set k
x))) = Set k
x
toSet :: Ord k => Set.Set k -> Set k
toSet :: Set k -> Set k
toSet Set k
x = Invariant (Trigger [k], Hide (Set k)) -> Set k
forall k. Invariant (Trigger [k], Hide (Set k)) -> Set k
Set (Invariant (Trigger [k], Hide (Set k)) -> Set k)
-> Invariant (Trigger [k], Hide (Set k)) -> Set k
forall a b. (a -> b) -> a -> b
$ ((Trigger [k], Hide (Set k)) -> (Trigger [k], Hide (Set k)))
-> (Trigger [k], Hide (Set k))
-> Invariant (Trigger [k], Hide (Set k))
forall a. (a -> a) -> a -> Invariant a
Invariant (Trigger [k], Hide (Set k)) -> (Trigger [k], Hide (Set k))
forall a.
Ord a =>
(Trigger [a], Hide (Set a)) -> (Trigger [a], Hide (Set a))
inv ((Trigger [k], Hide (Set k))
-> Invariant (Trigger [k], Hide (Set k)))
-> (Trigger [k], Hide (Set k))
-> Invariant (Trigger [k], Hide (Set k))
forall a b. (a -> b) -> a -> b
$ Set k -> (Trigger [k], Hide (Set k))
forall a. Set a -> (Trigger [a], Hide (Set a))
create Set k
x
where
create :: Set a -> (Trigger [a], Hide (Set a))
create Set a
x = (Bool -> [a] -> Trigger [a]
forall a. Bool -> a -> Trigger a
Trigger Bool
False ([a] -> Trigger [a]) -> [a] -> Trigger [a]
forall a b. (a -> b) -> a -> b
$ Set a -> [a]
forall a. Set a -> [a]
Set.toList Set a
x, Set a -> Hide (Set a)
forall a. a -> Hide a
Hide Set a
x)
inv :: (Trigger [a], Hide (Set a)) -> (Trigger [a], Hide (Set a))
inv (Trigger [a]
ks,Hide (Set a)
x)
| Trigger [a] -> Bool
forall a. Trigger a -> Bool
trigger Trigger [a]
ks = Set a -> (Trigger [a], Hide (Set a))
forall a. Set a -> (Trigger [a], Hide (Set a))
create (Set a -> (Trigger [a], Hide (Set a)))
-> Set a -> (Trigger [a], Hide (Set a))
forall a b. (a -> b) -> a -> b
$ [a] -> Set a
forall a. Ord a => [a] -> Set a
Set.fromList ([a] -> Set a) -> [a] -> Set a
forall a b. (a -> b) -> a -> b
$ Trigger [a] -> [a]
forall a. Trigger a -> a
fromTrigger Trigger [a]
ks
| Bool
otherwise = (Trigger [a]
ks,Hide (Set a)
x)
newtype IntMap v = IntMap (Invariant (Trigger [Int], Trigger [v], Hide (IntMap.IntMap v)))
deriving (Typeable (IntMap v)
DataType
Constr
Typeable (IntMap v)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntMap v -> c (IntMap v))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (IntMap v))
-> (IntMap v -> Constr)
-> (IntMap v -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (IntMap v)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (IntMap v)))
-> ((forall b. Data b => b -> b) -> IntMap v -> IntMap v)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntMap v -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntMap v -> r)
-> (forall u. (forall d. Data d => d -> u) -> IntMap v -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> IntMap v -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v))
-> Data (IntMap v)
IntMap v -> DataType
IntMap v -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (IntMap v))
(forall b. Data b => b -> b) -> IntMap v -> IntMap v
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntMap v -> c (IntMap v)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (IntMap v)
forall v. Data v => Typeable (IntMap v)
forall v. Data v => IntMap v -> DataType
forall v. Data v => IntMap v -> Constr
forall v.
Data v =>
(forall b. Data b => b -> b) -> IntMap v -> IntMap v
forall v u.
Data v =>
Int -> (forall d. Data d => d -> u) -> IntMap v -> u
forall v u.
Data v =>
(forall d. Data d => d -> u) -> IntMap v -> [u]
forall v r r'.
Data v =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntMap v -> r
forall v r r'.
Data v =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntMap v -> r
forall v (m :: * -> *).
(Data v, Monad m) =>
(forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v)
forall v (m :: * -> *).
(Data v, MonadPlus m) =>
(forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v)
forall v (c :: * -> *).
Data v =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (IntMap v)
forall v (c :: * -> *).
Data v =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntMap v -> c (IntMap v)
forall v (t :: * -> *) (c :: * -> *).
(Data v, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (IntMap v))
forall v (t :: * -> * -> *) (c :: * -> *).
(Data v, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (IntMap v))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> IntMap v -> u
forall u. (forall d. Data d => d -> u) -> IntMap v -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntMap v -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntMap v -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (IntMap v)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntMap v -> c (IntMap v)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (IntMap v))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (IntMap v))
$cIntMap :: Constr
$tIntMap :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v)
$cgmapMo :: forall v (m :: * -> *).
(Data v, MonadPlus m) =>
(forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v)
gmapMp :: (forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v)
$cgmapMp :: forall v (m :: * -> *).
(Data v, MonadPlus m) =>
(forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v)
gmapM :: (forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v)
$cgmapM :: forall v (m :: * -> *).
(Data v, Monad m) =>
(forall d. Data d => d -> m d) -> IntMap v -> m (IntMap v)
gmapQi :: Int -> (forall d. Data d => d -> u) -> IntMap v -> u
$cgmapQi :: forall v u.
Data v =>
Int -> (forall d. Data d => d -> u) -> IntMap v -> u
gmapQ :: (forall d. Data d => d -> u) -> IntMap v -> [u]
$cgmapQ :: forall v u.
Data v =>
(forall d. Data d => d -> u) -> IntMap v -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntMap v -> r
$cgmapQr :: forall v r r'.
Data v =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntMap v -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntMap v -> r
$cgmapQl :: forall v r r'.
Data v =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntMap v -> r
gmapT :: (forall b. Data b => b -> b) -> IntMap v -> IntMap v
$cgmapT :: forall v.
Data v =>
(forall b. Data b => b -> b) -> IntMap v -> IntMap v
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (IntMap v))
$cdataCast2 :: forall v (t :: * -> * -> *) (c :: * -> *).
(Data v, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (IntMap v))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (IntMap v))
$cdataCast1 :: forall v (t :: * -> *) (c :: * -> *).
(Data v, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (IntMap v))
dataTypeOf :: IntMap v -> DataType
$cdataTypeOf :: forall v. Data v => IntMap v -> DataType
toConstr :: IntMap v -> Constr
$ctoConstr :: forall v. Data v => IntMap v -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (IntMap v)
$cgunfold :: forall v (c :: * -> *).
Data v =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (IntMap v)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntMap v -> c (IntMap v)
$cgfoldl :: forall v (c :: * -> *).
Data v =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntMap v -> c (IntMap v)
$cp1Data :: forall v. Data v => Typeable (IntMap v)
Data, Typeable)
instance Show v => Show (IntMap v) where; show :: IntMap v -> String
show = IntMap v -> String
forall a. Show a => a -> String
show (IntMap v -> String)
-> (IntMap v -> IntMap v) -> IntMap v -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IntMap v -> IntMap v
forall v. IntMap v -> IntMap v
fromIntMap
instance Eq v => Eq (IntMap v) where; IntMap v
a == :: IntMap v -> IntMap v -> Bool
== IntMap v
b = IntMap v -> IntMap v
forall v. IntMap v -> IntMap v
fromIntMap IntMap v
a IntMap v -> IntMap v -> Bool
forall a. Eq a => a -> a -> Bool
== IntMap v -> IntMap v
forall v. IntMap v -> IntMap v
fromIntMap IntMap v
b
instance Ord v => Ord (IntMap v) where; compare :: IntMap v -> IntMap v -> Ordering
compare IntMap v
a IntMap v
b = IntMap v -> IntMap v -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (IntMap v -> IntMap v
forall v. IntMap v -> IntMap v
fromIntMap IntMap v
a) (IntMap v -> IntMap v
forall v. IntMap v -> IntMap v
fromIntMap IntMap v
b)
fromIntMap :: IntMap v -> IntMap.IntMap v
fromIntMap :: IntMap v -> IntMap v
fromIntMap (IntMap (Invariant (Trigger [Int], Trigger [v], Hide (IntMap v))
-> (Trigger [Int], Trigger [v], Hide (IntMap v))
_ (Trigger [Int]
_,Trigger [v]
_,Hide IntMap v
x))) = IntMap v
x
toIntMap :: IntMap.IntMap v -> IntMap v
toIntMap :: IntMap v -> IntMap v
toIntMap IntMap v
x = Invariant (Trigger [Int], Trigger [v], Hide (IntMap v)) -> IntMap v
forall v.
Invariant (Trigger [Int], Trigger [v], Hide (IntMap v)) -> IntMap v
IntMap (Invariant (Trigger [Int], Trigger [v], Hide (IntMap v))
-> IntMap v)
-> Invariant (Trigger [Int], Trigger [v], Hide (IntMap v))
-> IntMap v
forall a b. (a -> b) -> a -> b
$ ((Trigger [Int], Trigger [v], Hide (IntMap v))
-> (Trigger [Int], Trigger [v], Hide (IntMap v)))
-> (Trigger [Int], Trigger [v], Hide (IntMap v))
-> Invariant (Trigger [Int], Trigger [v], Hide (IntMap v))
forall a. (a -> a) -> a -> Invariant a
Invariant (Trigger [Int], Trigger [v], Hide (IntMap v))
-> (Trigger [Int], Trigger [v], Hide (IntMap v))
forall b.
(Trigger [Int], Trigger [b], Hide (IntMap b))
-> (Trigger [Int], Trigger [b], Hide (IntMap b))
inv ((Trigger [Int], Trigger [v], Hide (IntMap v))
-> Invariant (Trigger [Int], Trigger [v], Hide (IntMap v)))
-> (Trigger [Int], Trigger [v], Hide (IntMap v))
-> Invariant (Trigger [Int], Trigger [v], Hide (IntMap v))
forall a b. (a -> b) -> a -> b
$ IntMap v -> (Trigger [Int], Trigger [v], Hide (IntMap v))
forall b. IntMap b -> (Trigger [Int], Trigger [b], Hide (IntMap b))
create IntMap v
x
where
create :: IntMap b -> (Trigger [Int], Trigger [b], Hide (IntMap b))
create IntMap b
x = (Bool -> [Int] -> Trigger [Int]
forall a. Bool -> a -> Trigger a
Trigger Bool
False [Int]
ks, Bool -> [b] -> Trigger [b]
forall a. Bool -> a -> Trigger a
Trigger Bool
False [b]
vs, IntMap b -> Hide (IntMap b)
forall a. a -> Hide a
Hide IntMap b
x)
where ([Int]
ks,[b]
vs) = [(Int, b)] -> ([Int], [b])
forall a b. [(a, b)] -> ([a], [b])
unzip ([(Int, b)] -> ([Int], [b])) -> [(Int, b)] -> ([Int], [b])
forall a b. (a -> b) -> a -> b
$ IntMap b -> [(Int, b)]
forall a. IntMap a -> [(Int, a)]
IntMap.toAscList IntMap b
x
inv :: (Trigger [Int], Trigger [b], Hide (IntMap b))
-> (Trigger [Int], Trigger [b], Hide (IntMap b))
inv (Trigger [Int]
ks,Trigger [b]
vs,Hide (IntMap b)
x)
| Trigger [Int] -> Bool
forall a. Trigger a -> Bool
trigger Trigger [Int]
ks = IntMap b -> (Trigger [Int], Trigger [b], Hide (IntMap b))
forall b. IntMap b -> (Trigger [Int], Trigger [b], Hide (IntMap b))
create (IntMap b -> (Trigger [Int], Trigger [b], Hide (IntMap b)))
-> IntMap b -> (Trigger [Int], Trigger [b], Hide (IntMap b))
forall a b. (a -> b) -> a -> b
$ [(Int, b)] -> IntMap b
forall a. [(Int, a)] -> IntMap a
IntMap.fromList ([(Int, b)] -> IntMap b) -> [(Int, b)] -> IntMap b
forall a b. (a -> b) -> a -> b
$ [Int] -> [b] -> [(Int, b)]
forall a b. [a] -> [b] -> [(a, b)]
zip (Trigger [Int] -> [Int]
forall a. Trigger a -> a
fromTrigger Trigger [Int]
ks) (Trigger [b] -> [b]
forall a. Trigger a -> a
fromTrigger Trigger [b]
vs)
| Trigger [b] -> Bool
forall a. Trigger a -> Bool
trigger Trigger [b]
vs = IntMap b -> (Trigger [Int], Trigger [b], Hide (IntMap b))
forall b. IntMap b -> (Trigger [Int], Trigger [b], Hide (IntMap b))
create (IntMap b -> (Trigger [Int], Trigger [b], Hide (IntMap b)))
-> IntMap b -> (Trigger [Int], Trigger [b], Hide (IntMap b))
forall a b. (a -> b) -> a -> b
$ [(Int, b)] -> IntMap b
forall a. [(Int, a)] -> IntMap a
IntMap.fromDistinctAscList ([(Int, b)] -> IntMap b) -> [(Int, b)] -> IntMap b
forall a b. (a -> b) -> a -> b
$ [Int] -> [b] -> [(Int, b)]
forall a b. [a] -> [b] -> [(a, b)]
zip (Trigger [Int] -> [Int]
forall a. Trigger a -> a
fromTrigger Trigger [Int]
ks) (Trigger [b] -> [b]
forall a. Trigger a -> a
fromTrigger Trigger [b]
vs)
| Bool
otherwise = (Trigger [Int]
ks,Trigger [b]
vs,Hide (IntMap b)
x)
newtype IntSet = IntSet (Invariant (Trigger [Int], Hide (IntSet.IntSet)))
deriving (Typeable IntSet
DataType
Constr
Typeable IntSet
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntSet -> c IntSet)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntSet)
-> (IntSet -> Constr)
-> (IntSet -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntSet))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntSet))
-> ((forall b. Data b => b -> b) -> IntSet -> IntSet)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IntSet -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IntSet -> r)
-> (forall u. (forall d. Data d => d -> u) -> IntSet -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> IntSet -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntSet -> m IntSet)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntSet -> m IntSet)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntSet -> m IntSet)
-> Data IntSet
IntSet -> DataType
IntSet -> Constr
(forall b. Data b => b -> b) -> IntSet -> IntSet
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntSet -> c IntSet
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntSet
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> IntSet -> u
forall u. (forall d. Data d => d -> u) -> IntSet -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntSet -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntSet -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntSet -> m IntSet
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntSet -> m IntSet
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntSet
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntSet -> c IntSet
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntSet)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntSet)
$cIntSet :: Constr
$tIntSet :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> IntSet -> m IntSet
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntSet -> m IntSet
gmapMp :: (forall d. Data d => d -> m d) -> IntSet -> m IntSet
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IntSet -> m IntSet
gmapM :: (forall d. Data d => d -> m d) -> IntSet -> m IntSet
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IntSet -> m IntSet
gmapQi :: Int -> (forall d. Data d => d -> u) -> IntSet -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> IntSet -> u
gmapQ :: (forall d. Data d => d -> u) -> IntSet -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IntSet -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntSet -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IntSet -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntSet -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IntSet -> r
gmapT :: (forall b. Data b => b -> b) -> IntSet -> IntSet
$cgmapT :: (forall b. Data b => b -> b) -> IntSet -> IntSet
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntSet)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IntSet)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c IntSet)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IntSet)
dataTypeOf :: IntSet -> DataType
$cdataTypeOf :: IntSet -> DataType
toConstr :: IntSet -> Constr
$ctoConstr :: IntSet -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntSet
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IntSet
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntSet -> c IntSet
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IntSet -> c IntSet
$cp1Data :: Typeable IntSet
Data, Typeable)
instance Show IntSet where; show :: IntSet -> String
show = IntSet -> String
forall a. Show a => a -> String
show (IntSet -> String) -> (IntSet -> IntSet) -> IntSet -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IntSet -> IntSet
fromIntSet
instance Eq IntSet where; IntSet
a == :: IntSet -> IntSet -> Bool
== IntSet
b = IntSet -> IntSet
fromIntSet IntSet
a IntSet -> IntSet -> Bool
forall a. Eq a => a -> a -> Bool
== IntSet -> IntSet
fromIntSet IntSet
b
instance Ord IntSet where; compare :: IntSet -> IntSet -> Ordering
compare IntSet
a IntSet
b = IntSet -> IntSet -> Ordering
forall a. Ord a => a -> a -> Ordering
compare (IntSet -> IntSet
fromIntSet IntSet
a) (IntSet -> IntSet
fromIntSet IntSet
b)
fromIntSet :: IntSet -> IntSet.IntSet
fromIntSet :: IntSet -> IntSet
fromIntSet (IntSet (Invariant (Trigger [Int], Hide IntSet) -> (Trigger [Int], Hide IntSet)
_ (Trigger [Int]
_,Hide IntSet
x))) = IntSet
x
toIntSet :: IntSet.IntSet -> IntSet
toIntSet :: IntSet -> IntSet
toIntSet IntSet
x = Invariant (Trigger [Int], Hide IntSet) -> IntSet
IntSet (Invariant (Trigger [Int], Hide IntSet) -> IntSet)
-> Invariant (Trigger [Int], Hide IntSet) -> IntSet
forall a b. (a -> b) -> a -> b
$ ((Trigger [Int], Hide IntSet) -> (Trigger [Int], Hide IntSet))
-> (Trigger [Int], Hide IntSet)
-> Invariant (Trigger [Int], Hide IntSet)
forall a. (a -> a) -> a -> Invariant a
Invariant (Trigger [Int], Hide IntSet) -> (Trigger [Int], Hide IntSet)
inv ((Trigger [Int], Hide IntSet)
-> Invariant (Trigger [Int], Hide IntSet))
-> (Trigger [Int], Hide IntSet)
-> Invariant (Trigger [Int], Hide IntSet)
forall a b. (a -> b) -> a -> b
$ IntSet -> (Trigger [Int], Hide IntSet)
create IntSet
x
where
create :: IntSet -> (Trigger [Int], Hide IntSet)
create IntSet
x = (Bool -> [Int] -> Trigger [Int]
forall a. Bool -> a -> Trigger a
Trigger Bool
False ([Int] -> Trigger [Int]) -> [Int] -> Trigger [Int]
forall a b. (a -> b) -> a -> b
$ IntSet -> [Int]
IntSet.toList IntSet
x, IntSet -> Hide IntSet
forall a. a -> Hide a
Hide IntSet
x)
inv :: (Trigger [Int], Hide IntSet) -> (Trigger [Int], Hide IntSet)
inv (Trigger [Int]
ks,Hide IntSet
x)
| Trigger [Int] -> Bool
forall a. Trigger a -> Bool
trigger Trigger [Int]
ks = IntSet -> (Trigger [Int], Hide IntSet)
create (IntSet -> (Trigger [Int], Hide IntSet))
-> IntSet -> (Trigger [Int], Hide IntSet)
forall a b. (a -> b) -> a -> b
$ [Int] -> IntSet
IntSet.fromList ([Int] -> IntSet) -> [Int] -> IntSet
forall a b. (a -> b) -> a -> b
$ Trigger [Int] -> [Int]
forall a. Trigger a -> a
fromTrigger Trigger [Int]
ks
| Bool
otherwise = (Trigger [Int]
ks,Hide IntSet
x)