module Language.Parser.Ptera.Data.Alignable.Map ( T, Map, empty, singleton, insert, lookup, assocs, toAscList, restrictGreaterOrEqual, ) where import Language.Parser.Ptera.Prelude hiding (empty, lookup) import qualified Data.IntMap.Strict as IntMap import qualified Language.Parser.Ptera.Data.Alignable as Alignable import qualified Language.Parser.Ptera.Data.IntMap.GreaterRestriction as GreaterRestriction type T = Map newtype Map n a = Map (IntMap.IntMap a) deriving (Map n a -> Map n a -> Bool (Map n a -> Map n a -> Bool) -> (Map n a -> Map n a -> Bool) -> Eq (Map n a) forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a forall k (n :: k) a. Eq a => Map n a -> Map n a -> Bool /= :: Map n a -> Map n a -> Bool $c/= :: forall k (n :: k) a. Eq a => Map n a -> Map n a -> Bool == :: Map n a -> Map n a -> Bool $c== :: forall k (n :: k) a. Eq a => Map n a -> Map n a -> Bool Eq, Int -> Map n a -> ShowS [Map n a] -> ShowS Map n a -> String (Int -> Map n a -> ShowS) -> (Map n a -> String) -> ([Map n a] -> ShowS) -> Show (Map n a) forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a forall k (n :: k) a. Show a => Int -> Map n a -> ShowS forall k (n :: k) a. Show a => [Map n a] -> ShowS forall k (n :: k) a. Show a => Map n a -> String showList :: [Map n a] -> ShowS $cshowList :: forall k (n :: k) a. Show a => [Map n a] -> ShowS show :: Map n a -> String $cshow :: forall k (n :: k) a. Show a => Map n a -> String showsPrec :: Int -> Map n a -> ShowS $cshowsPrec :: forall k (n :: k) a. Show a => Int -> Map n a -> ShowS Show, a -> Map n b -> Map n a (a -> b) -> Map n a -> Map n b (forall a b. (a -> b) -> Map n a -> Map n b) -> (forall a b. a -> Map n b -> Map n a) -> Functor (Map n) forall k (n :: k) a b. a -> Map n b -> Map n a forall k (n :: k) a b. (a -> b) -> Map n a -> Map n b forall a b. a -> Map n b -> Map n a forall a b. (a -> b) -> Map n a -> Map n b forall (f :: * -> *). (forall a b. (a -> b) -> f a -> f b) -> (forall a b. a -> f b -> f a) -> Functor f <$ :: a -> Map n b -> Map n a $c<$ :: forall k (n :: k) a b. a -> Map n b -> Map n a fmap :: (a -> b) -> Map n a -> Map n b $cfmap :: forall k (n :: k) a b. (a -> b) -> Map n a -> Map n b Functor, Map n a -> Bool (a -> m) -> Map n a -> m (a -> b -> b) -> b -> Map n a -> b (forall m. Monoid m => Map n m -> m) -> (forall m a. Monoid m => (a -> m) -> Map n a -> m) -> (forall m a. Monoid m => (a -> m) -> Map n a -> m) -> (forall a b. (a -> b -> b) -> b -> Map n a -> b) -> (forall a b. (a -> b -> b) -> b -> Map n a -> b) -> (forall b a. (b -> a -> b) -> b -> Map n a -> b) -> (forall b a. (b -> a -> b) -> b -> Map n a -> b) -> (forall a. (a -> a -> a) -> Map n a -> a) -> (forall a. (a -> a -> a) -> Map n a -> a) -> (forall a. Map n a -> [a]) -> (forall a. Map n a -> Bool) -> (forall a. Map n a -> Int) -> (forall a. Eq a => a -> Map n a -> Bool) -> (forall a. Ord a => Map n a -> a) -> (forall a. Ord a => Map n a -> a) -> (forall a. Num a => Map n a -> a) -> (forall a. Num a => Map n a -> a) -> Foldable (Map n) forall a. Eq a => a -> Map n a -> Bool forall a. Num a => Map n a -> a forall a. Ord a => Map n a -> a forall m. Monoid m => Map n m -> m forall a. Map n a -> Bool forall a. Map n a -> Int forall a. Map n a -> [a] forall a. (a -> a -> a) -> Map n a -> a forall k (n :: k) a. Eq a => a -> Map n a -> Bool forall k (n :: k) a. Num a => Map n a -> a forall k (n :: k) a. Ord a => Map n a -> a forall k (n :: k) m. Monoid m => Map n m -> m forall k (n :: k) a. Map n a -> Bool forall k (n :: k) a. Map n a -> Int forall k (n :: k) a. Map n a -> [a] forall k (n :: k) a. (a -> a -> a) -> Map n a -> a forall k (n :: k) m a. Monoid m => (a -> m) -> Map n a -> m forall k (n :: k) b a. (b -> a -> b) -> b -> Map n a -> b forall k (n :: k) a b. (a -> b -> b) -> b -> Map n a -> b forall m a. Monoid m => (a -> m) -> Map n a -> m forall b a. (b -> a -> b) -> b -> Map n a -> b forall a b. (a -> b -> b) -> b -> Map n a -> b forall (t :: * -> *). (forall m. Monoid m => t m -> m) -> (forall m a. Monoid m => (a -> m) -> t a -> m) -> (forall m a. Monoid m => (a -> m) -> t a -> m) -> (forall a b. (a -> b -> b) -> b -> t a -> b) -> (forall a b. (a -> b -> b) -> b -> t a -> b) -> (forall b a. (b -> a -> b) -> b -> t a -> b) -> (forall b a. (b -> a -> b) -> b -> t a -> b) -> (forall a. (a -> a -> a) -> t a -> a) -> (forall a. (a -> a -> a) -> t a -> a) -> (forall a. t a -> [a]) -> (forall a. t a -> Bool) -> (forall a. t a -> Int) -> (forall a. Eq a => a -> t a -> Bool) -> (forall a. Ord a => t a -> a) -> (forall a. Ord a => t a -> a) -> (forall a. Num a => t a -> a) -> (forall a. Num a => t a -> a) -> Foldable t product :: Map n a -> a $cproduct :: forall k (n :: k) a. Num a => Map n a -> a sum :: Map n a -> a $csum :: forall k (n :: k) a. Num a => Map n a -> a minimum :: Map n a -> a $cminimum :: forall k (n :: k) a. Ord a => Map n a -> a maximum :: Map n a -> a $cmaximum :: forall k (n :: k) a. Ord a => Map n a -> a elem :: a -> Map n a -> Bool $celem :: forall k (n :: k) a. Eq a => a -> Map n a -> Bool length :: Map n a -> Int $clength :: forall k (n :: k) a. Map n a -> Int null :: Map n a -> Bool $cnull :: forall k (n :: k) a. Map n a -> Bool toList :: Map n a -> [a] $ctoList :: forall k (n :: k) a. Map n a -> [a] foldl1 :: (a -> a -> a) -> Map n a -> a $cfoldl1 :: forall k (n :: k) a. (a -> a -> a) -> Map n a -> a foldr1 :: (a -> a -> a) -> Map n a -> a $cfoldr1 :: forall k (n :: k) a. (a -> a -> a) -> Map n a -> a foldl' :: (b -> a -> b) -> b -> Map n a -> b $cfoldl' :: forall k (n :: k) b a. (b -> a -> b) -> b -> Map n a -> b foldl :: (b -> a -> b) -> b -> Map n a -> b $cfoldl :: forall k (n :: k) b a. (b -> a -> b) -> b -> Map n a -> b foldr' :: (a -> b -> b) -> b -> Map n a -> b $cfoldr' :: forall k (n :: k) a b. (a -> b -> b) -> b -> Map n a -> b foldr :: (a -> b -> b) -> b -> Map n a -> b $cfoldr :: forall k (n :: k) a b. (a -> b -> b) -> b -> Map n a -> b foldMap' :: (a -> m) -> Map n a -> m $cfoldMap' :: forall k (n :: k) m a. Monoid m => (a -> m) -> Map n a -> m foldMap :: (a -> m) -> Map n a -> m $cfoldMap :: forall k (n :: k) m a. Monoid m => (a -> m) -> Map n a -> m fold :: Map n m -> m $cfold :: forall k (n :: k) m. Monoid m => Map n m -> m Foldable, Functor (Map n) Foldable (Map n) Functor (Map n) -> Foldable (Map n) -> (forall (f :: * -> *) a b. Applicative f => (a -> f b) -> Map n a -> f (Map n b)) -> (forall (f :: * -> *) a. Applicative f => Map n (f a) -> f (Map n a)) -> (forall (m :: * -> *) a b. Monad m => (a -> m b) -> Map n a -> m (Map n b)) -> (forall (m :: * -> *) a. Monad m => Map n (m a) -> m (Map n a)) -> Traversable (Map n) (a -> f b) -> Map n a -> f (Map n b) forall k (n :: k). Functor (Map n) forall k (n :: k). Foldable (Map n) forall k (n :: k) (m :: * -> *) a. Monad m => Map n (m a) -> m (Map n a) forall k (n :: k) (f :: * -> *) a. Applicative f => Map n (f a) -> f (Map n a) forall k (n :: k) (m :: * -> *) a b. Monad m => (a -> m b) -> Map n a -> m (Map n b) forall k (n :: k) (f :: * -> *) a b. Applicative f => (a -> f b) -> Map n a -> f (Map n b) forall (t :: * -> *). Functor t -> Foldable t -> (forall (f :: * -> *) a b. Applicative f => (a -> f b) -> t a -> f (t b)) -> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a)) -> (forall (m :: * -> *) a b. Monad m => (a -> m b) -> t a -> m (t b)) -> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a)) -> Traversable t forall (m :: * -> *) a. Monad m => Map n (m a) -> m (Map n a) forall (f :: * -> *) a. Applicative f => Map n (f a) -> f (Map n a) forall (m :: * -> *) a b. Monad m => (a -> m b) -> Map n a -> m (Map n b) forall (f :: * -> *) a b. Applicative f => (a -> f b) -> Map n a -> f (Map n b) sequence :: Map n (m a) -> m (Map n a) $csequence :: forall k (n :: k) (m :: * -> *) a. Monad m => Map n (m a) -> m (Map n a) mapM :: (a -> m b) -> Map n a -> m (Map n b) $cmapM :: forall k (n :: k) (m :: * -> *) a b. Monad m => (a -> m b) -> Map n a -> m (Map n b) sequenceA :: Map n (f a) -> f (Map n a) $csequenceA :: forall k (n :: k) (f :: * -> *) a. Applicative f => Map n (f a) -> f (Map n a) traverse :: (a -> f b) -> Map n a -> f (Map n b) $ctraverse :: forall k (n :: k) (f :: * -> *) a b. Applicative f => (a -> f b) -> Map n a -> f (Map n b) $cp2Traversable :: forall k (n :: k). Foldable (Map n) $cp1Traversable :: forall k (n :: k). Functor (Map n) Traversable) empty :: Map n a empty :: Map n a empty = IntMap a -> Map n a forall k (n :: k) a. IntMap a -> Map n a Map IntMap a forall a. IntMap a IntMap.empty singleton :: forall n a. Alignable.T n => n -> a -> Map n a singleton :: n -> a -> Map n a singleton = (Int -> a -> IntMap a) -> n -> a -> Map n a coerce do Int -> a -> IntMap a forall a. Int -> a -> IntMap a IntMap.singleton @a insert :: forall n a. Alignable.T n => n -> a -> Map n a -> Map n a insert :: n -> a -> Map n a -> Map n a insert = (Int -> a -> IntMap a -> IntMap a) -> n -> a -> Map n a -> Map n a coerce do Int -> a -> IntMap a -> IntMap a forall a. Int -> a -> IntMap a -> IntMap a IntMap.insert @a lookup :: forall n a. Alignable.T n => n -> Map n a -> Maybe a lookup :: n -> Map n a -> Maybe a lookup = (Int -> IntMap a -> Maybe a) -> n -> Map n a -> Maybe a coerce do Int -> IntMap a -> Maybe a forall a. Int -> IntMap a -> Maybe a IntMap.lookup @a assocs :: forall n a. Alignable.T n => Map n a -> [(n, a)] assocs :: Map n a -> [(n, a)] assocs = (IntMap a -> [(Int, a)]) -> Map n a -> [(n, a)] coerce do IntMap a -> [(Int, a)] forall a. IntMap a -> [(Int, a)] IntMap.assocs @a toAscList :: forall n a. Alignable.T n => Map n a -> [(n, a)] toAscList :: Map n a -> [(n, a)] toAscList = (IntMap a -> [(Int, a)]) -> Map n a -> [(n, a)] coerce do IntMap a -> [(Int, a)] forall a. IntMap a -> [(Int, a)] IntMap.toAscList @a restrictGreaterOrEqual :: forall n a. Alignable.T n => n -> Map n a -> Map n a restrictGreaterOrEqual :: n -> Map n a -> Map n a restrictGreaterOrEqual n n (Map IntMap a m) = IntMap a -> Map n a forall k (n :: k) a. IntMap a -> Map n a Map do Int -> IntMap a -> IntMap a forall a. Int -> IntMap a -> IntMap a GreaterRestriction.restrictGreater (n -> Int coerce n n Int -> Int -> Int forall a. Num a => a -> a -> a - Int 1) IntMap a m