GHC.Data.TrieMap

ghc-9.2.0.20210331: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.Data.TrieMap

Contents

- Maps over `Maybe` values
- Maps over `List` values
- Maps over `Literal`s
- `TrieMap` class
- Things helpful for adding additional Instances.
- Map for leaf compression

Synopsis

- data MaybeMap m a
- data ListMap m a
- type LiteralMap a = Map Literal a
- class TrieMap m where
  - type Key m :: Type
  - emptyTM :: m a
  - lookupTM :: forall b. Key m -> m b -> Maybe b
  - alterTM :: forall b. Key m -> XT b -> m b -> m b
  - mapTM :: (a -> b) -> m a -> m b
  - filterTM :: (a -> Bool) -> m a -> m a
  - foldTM :: (a -> b -> b) -> m a -> b -> b
- insertTM :: TrieMap m => Key m -> a -> m a -> m a
- deleteTM :: TrieMap m => Key m -> m a -> m a
- foldMapTM :: (TrieMap m, Monoid r) => (a -> r) -> m a -> r
- isEmptyTM :: TrieMap m => m a -> Bool
- (>.>) :: (a -> b) -> (b -> c) -> a -> c
- (|>) :: a -> (a -> b) -> b
- (|>>) :: TrieMap m2 => (XT (m2 a) -> m1 (m2 a) -> m1 (m2 a)) -> (m2 a -> m2 a) -> m1 (m2 a) -> m1 (m2 a)
- type XT a = Maybe a -> Maybe a
- foldMaybe :: (a -> b -> b) -> Maybe a -> b -> b
- filterMaybe :: (a -> Bool) -> Maybe a -> Maybe a
- data GenMap m a
- lkG :: (Eq (Key m), TrieMap m) => Key m -> GenMap m a -> Maybe a
- xtG :: (Eq (Key m), TrieMap m) => Key m -> XT a -> GenMap m a -> GenMap m a
- mapG :: TrieMap m => (a -> b) -> GenMap m a -> GenMap m b
- fdG :: TrieMap m => (a -> b -> b) -> GenMap m a -> b -> b
- xtList :: TrieMap m => (forall b. k -> XT b -> m b -> m b) -> [k] -> XT a -> ListMap m a -> ListMap m a
- lkList :: TrieMap m => (forall b. k -> m b -> Maybe b) -> [k] -> ListMap m a -> Maybe a

# Maps over `Maybe` values

data MaybeMap m a Source #

#### Instances

Instances details

TrieMap m => Foldable (MaybeMap m) # |
Instance details Defined in GHC.Data.TrieMap Methods fold :: Monoid m0 => MaybeMap m m0 -> m0 Source # foldMap :: Monoid m0 => (a -> m0) -> MaybeMap m a -> m0 Source # foldMap' :: Monoid m0 => (a -> m0) -> MaybeMap m a -> m0 Source # foldr :: (a -> b -> b) -> b -> MaybeMap m a -> b Source # foldr' :: (a -> b -> b) -> b -> MaybeMap m a -> b Source # foldl :: (b -> a -> b) -> b -> MaybeMap m a -> b Source # foldl' :: (b -> a -> b) -> b -> MaybeMap m a -> b Source # foldr1 :: (a -> a -> a) -> MaybeMap m a -> a Source # foldl1 :: (a -> a -> a) -> MaybeMap m a -> a Source # toList :: MaybeMap m a -> [a] Source # null :: MaybeMap m a -> Bool Source # length :: MaybeMap m a -> Int Source # elem :: Eq a => a -> MaybeMap m a -> Bool Source # maximum :: Ord a => MaybeMap m a -> a Source # minimum :: Ord a => MaybeMap m a -> a Source # sum :: Num a => MaybeMap m a -> a Source # product :: Num a => MaybeMap m a -> a Source #
TrieMap m => TrieMap (MaybeMap m) # |
Instance details Defined in GHC.Data.TrieMap Associated Types type Key (MaybeMap m) Source # Methods emptyTM :: MaybeMap m a Source # lookupTM :: Key (MaybeMap m) -> MaybeMap m b -> Maybe b Source # alterTM :: Key (MaybeMap m) -> XT b -> MaybeMap m b -> MaybeMap m b Source # mapTM :: (a -> b) -> MaybeMap m a -> MaybeMap m b Source # filterTM :: (a -> Bool) -> MaybeMap m a -> MaybeMap m a Source # foldTM :: (a -> b -> b) -> MaybeMap m a -> b -> b Source #
type Key (MaybeMap m) # |
Instance details Defined in GHC.Data.TrieMap type Key (MaybeMap m) = Maybe (Key m)

# Maps over `List` values

data ListMap m a Source #

#### Instances

Instances details

TrieMap m => Foldable (ListMap m) # |
Instance details Defined in GHC.Data.TrieMap Methods fold :: Monoid m0 => ListMap m m0 -> m0 Source # foldMap :: Monoid m0 => (a -> m0) -> ListMap m a -> m0 Source # foldMap' :: Monoid m0 => (a -> m0) -> ListMap m a -> m0 Source # foldr :: (a -> b -> b) -> b -> ListMap m a -> b Source # foldr' :: (a -> b -> b) -> b -> ListMap m a -> b Source # foldl :: (b -> a -> b) -> b -> ListMap m a -> b Source # foldl' :: (b -> a -> b) -> b -> ListMap m a -> b Source # foldr1 :: (a -> a -> a) -> ListMap m a -> a Source # foldl1 :: (a -> a -> a) -> ListMap m a -> a Source # toList :: ListMap m a -> [a] Source # null :: ListMap m a -> Bool Source # length :: ListMap m a -> Int Source # elem :: Eq a => a -> ListMap m a -> Bool Source # maximum :: Ord a => ListMap m a -> a Source # minimum :: Ord a => ListMap m a -> a Source # sum :: Num a => ListMap m a -> a Source # product :: Num a => ListMap m a -> a Source #
TrieMap m => TrieMap (ListMap m) # |
Instance details Defined in GHC.Data.TrieMap Associated Types type Key (ListMap m) Source # Methods emptyTM :: ListMap m a Source # lookupTM :: Key (ListMap m) -> ListMap m b -> Maybe b Source # alterTM :: Key (ListMap m) -> XT b -> ListMap m b -> ListMap m b Source # mapTM :: (a -> b) -> ListMap m a -> ListMap m b Source # filterTM :: (a -> Bool) -> ListMap m a -> ListMap m a Source # foldTM :: (a -> b -> b) -> ListMap m a -> b -> b Source #
(TrieMap m, Outputable a) => Outputable (ListMap m a) # |
Instance details Defined in GHC.Data.TrieMap Methods ppr :: ListMap m a -> SDoc Source #
type Key (ListMap m) # |
Instance details Defined in GHC.Data.TrieMap type Key (ListMap m) = [Key m]

# Maps over `Literal`s

type LiteralMap a = Map Literal a Source #

# `TrieMap` class

class TrieMap m where Source #

Associated Types

type Key m :: Type Source #

Methods

emptyTM :: m a Source #

lookupTM :: forall b. Key m -> m b -> Maybe b Source #

alterTM :: forall b. Key m -> XT b -> m b -> m b Source #

mapTM :: (a -> b) -> m a -> m b Source #

filterTM :: (a -> Bool) -> m a -> m a Source #

foldTM :: (a -> b -> b) -> m a -> b -> b Source #

#### Instances

Instances details

TrieMap IntMap # |
Instance details Defined in GHC.Data.TrieMap Associated Types type Key IntMap Source # Methods emptyTM :: IntMap a Source # lookupTM :: Key IntMap -> IntMap b -> Maybe b Source # alterTM :: Key IntMap -> XT b -> IntMap b -> IntMap b Source # mapTM :: (a -> b) -> IntMap a -> IntMap b Source # filterTM :: (a -> Bool) -> IntMap a -> IntMap a Source # foldTM :: (a -> b -> b) -> IntMap a -> b -> b Source #
TrieMap LabelMap # |
Instance details Defined in GHC.Cmm.Dataflow.Label Associated Types type Key LabelMap Source # Methods emptyTM :: LabelMap a Source # lookupTM :: Key LabelMap -> LabelMap b -> Maybe b Source # alterTM :: Key LabelMap -> XT b -> LabelMap b -> LabelMap b Source # mapTM :: (a -> b) -> LabelMap a -> LabelMap b Source # filterTM :: (a -> Bool) -> LabelMap a -> LabelMap a Source # foldTM :: (a -> b -> b) -> LabelMap a -> b -> b Source #
TrieMap CoreMap # |
Instance details Defined in GHC.Core.Map.Expr Associated Types type Key CoreMap Source # Methods emptyTM :: CoreMap a Source # lookupTM :: Key CoreMap -> CoreMap b -> Maybe b Source # alterTM :: Key CoreMap -> XT b -> CoreMap b -> CoreMap b Source # mapTM :: (a -> b) -> CoreMap a -> CoreMap b Source # filterTM :: (a -> Bool) -> CoreMap a -> CoreMap a Source # foldTM :: (a -> b -> b) -> CoreMap a -> b -> b Source #
TrieMap BndrMap # |
Instance details Defined in GHC.Core.Map.Type Associated Types type Key BndrMap Source # Methods emptyTM :: BndrMap a Source # lookupTM :: Key BndrMap -> BndrMap b -> Maybe b Source # alterTM :: Key BndrMap -> XT b -> BndrMap b -> BndrMap b Source # mapTM :: (a -> b) -> BndrMap a -> BndrMap b Source # filterTM :: (a -> Bool) -> BndrMap a -> BndrMap a Source # foldTM :: (a -> b -> b) -> BndrMap a -> b -> b Source #
TrieMap LooseTypeMap # |
Instance details Defined in GHC.Core.Map.Type Associated Types type Key LooseTypeMap Source # Methods emptyTM :: LooseTypeMap a Source # lookupTM :: Key LooseTypeMap -> LooseTypeMap b -> Maybe b Source # alterTM :: Key LooseTypeMap -> XT b -> LooseTypeMap b -> LooseTypeMap b Source # mapTM :: (a -> b) -> LooseTypeMap a -> LooseTypeMap b Source # filterTM :: (a -> Bool) -> LooseTypeMap a -> LooseTypeMap a Source # foldTM :: (a -> b -> b) -> LooseTypeMap a -> b -> b Source #
TrieMap TypeMap # |
Instance details Defined in GHC.Core.Map.Type Associated Types type Key TypeMap Source # Methods emptyTM :: TypeMap a Source # lookupTM :: Key TypeMap -> TypeMap b -> Maybe b Source # alterTM :: Key TypeMap -> XT b -> TypeMap b -> TypeMap b Source # mapTM :: (a -> b) -> TypeMap a -> TypeMap b Source # filterTM :: (a -> Bool) -> TypeMap a -> TypeMap a Source # foldTM :: (a -> b -> b) -> TypeMap a -> b -> b Source #
TrieMap VarMap # |
Instance details Defined in GHC.Core.Map.Type Associated Types type Key VarMap Source # Methods emptyTM :: VarMap a Source # lookupTM :: Key VarMap -> VarMap b -> Maybe b Source # alterTM :: Key VarMap -> XT b -> VarMap b -> VarMap b Source # mapTM :: (a -> b) -> VarMap a -> VarMap b Source # filterTM :: (a -> Bool) -> VarMap a -> VarMap a Source # foldTM :: (a -> b -> b) -> VarMap a -> b -> b Source #
Ord k => TrieMap (Map k) # |
Instance details Defined in GHC.Data.TrieMap Associated Types type Key (Map k) Source # Methods emptyTM :: Map k a Source # lookupTM :: Key (Map k) -> Map k b -> Maybe b Source # alterTM :: Key (Map k) -> XT b -> Map k b -> Map k b Source # mapTM :: (a -> b) -> Map k a -> Map k b Source # filterTM :: (a -> Bool) -> Map k a -> Map k a Source # foldTM :: (a -> b -> b) -> Map k a -> b -> b Source #
(Eq (Key m), TrieMap m) => TrieMap (GenMap m) # |
Instance details Defined in GHC.Data.TrieMap Associated Types type Key (GenMap m) Source # Methods emptyTM :: GenMap m a Source # lookupTM :: Key (GenMap m) -> GenMap m b -> Maybe b Source # alterTM :: Key (GenMap m) -> XT b -> GenMap m b -> GenMap m b Source # mapTM :: (a -> b) -> GenMap m a -> GenMap m b Source # filterTM :: (a -> Bool) -> GenMap m a -> GenMap m a Source # foldTM :: (a -> b -> b) -> GenMap m a -> b -> b Source #
TrieMap m => TrieMap (ListMap m) # |
Instance details Defined in GHC.Data.TrieMap Associated Types type Key (ListMap m) Source # Methods emptyTM :: ListMap m a Source # lookupTM :: Key (ListMap m) -> ListMap m b -> Maybe b Source # alterTM :: Key (ListMap m) -> XT b -> ListMap m b -> ListMap m b Source # mapTM :: (a -> b) -> ListMap m a -> ListMap m b Source # filterTM :: (a -> Bool) -> ListMap m a -> ListMap m a Source # foldTM :: (a -> b -> b) -> ListMap m a -> b -> b Source #
TrieMap m => TrieMap (MaybeMap m) # |
Instance details Defined in GHC.Data.TrieMap Associated Types type Key (MaybeMap m) Source # Methods emptyTM :: MaybeMap m a Source # lookupTM :: Key (MaybeMap m) -> MaybeMap m b -> Maybe b Source # alterTM :: Key (MaybeMap m) -> XT b -> MaybeMap m b -> MaybeMap m b Source # mapTM :: (a -> b) -> MaybeMap m a -> MaybeMap m b Source # filterTM :: (a -> Bool) -> MaybeMap m a -> MaybeMap m a Source # foldTM :: (a -> b -> b) -> MaybeMap m a -> b -> b Source #
Uniquable key => TrieMap (UniqDFM key) # |
Instance details Defined in GHC.Data.TrieMap Associated Types type Key (UniqDFM key) Source # Methods emptyTM :: UniqDFM key a Source # lookupTM :: Key (UniqDFM key) -> UniqDFM key b -> Maybe b Source # alterTM :: Key (UniqDFM key) -> XT b -> UniqDFM key b -> UniqDFM key b Source # mapTM :: (a -> b) -> UniqDFM key a -> UniqDFM key b Source # filterTM :: (a -> Bool) -> UniqDFM key a -> UniqDFM key a Source # foldTM :: (a -> b -> b) -> UniqDFM key a -> b -> b Source #

insertTM :: TrieMap m => Key m -> a -> m a -> m a Source #

deleteTM :: TrieMap m => Key m -> m a -> m a Source #

foldMapTM :: (TrieMap m, Monoid r) => (a -> r) -> m a -> r Source #

isEmptyTM :: TrieMap m => m a -> Bool Source #

# Things helpful for adding additional Instances.

(>.>) :: (a -> b) -> (b -> c) -> a -> c infixr 1 Source #

(|>) :: a -> (a -> b) -> b infixr 1 Source #

(|>>) :: TrieMap m2 => (XT (m2 a) -> m1 (m2 a) -> m1 (m2 a)) -> (m2 a -> m2 a) -> m1 (m2 a) -> m1 (m2 a) infixr 1 Source #

type XT a = Maybe a -> Maybe a Source #

foldMaybe :: (a -> b -> b) -> Maybe a -> b -> b Source #

filterMaybe :: (a -> Bool) -> Maybe a -> Maybe a Source #

# Map for leaf compression

data GenMap m a Source #

#### Instances

Instances details

(Eq (Key m), TrieMap m) => Foldable (GenMap m) # |
Instance details Defined in GHC.Data.TrieMap Methods fold :: Monoid m0 => GenMap m m0 -> m0 Source # foldMap :: Monoid m0 => (a -> m0) -> GenMap m a -> m0 Source # foldMap' :: Monoid m0 => (a -> m0) -> GenMap m a -> m0 Source # foldr :: (a -> b -> b) -> b -> GenMap m a -> b Source # foldr' :: (a -> b -> b) -> b -> GenMap m a -> b Source # foldl :: (b -> a -> b) -> b -> GenMap m a -> b Source # foldl' :: (b -> a -> b) -> b -> GenMap m a -> b Source # foldr1 :: (a -> a -> a) -> GenMap m a -> a Source # foldl1 :: (a -> a -> a) -> GenMap m a -> a Source # toList :: GenMap m a -> [a] Source # null :: GenMap m a -> Bool Source # length :: GenMap m a -> Int Source # elem :: Eq a => a -> GenMap m a -> Bool Source # maximum :: Ord a => GenMap m a -> a Source # minimum :: Ord a => GenMap m a -> a Source # sum :: Num a => GenMap m a -> a Source # product :: Num a => GenMap m a -> a Source #
(Eq (Key m), TrieMap m) => TrieMap (GenMap m) # |
Instance details Defined in GHC.Data.TrieMap Associated Types type Key (GenMap m) Source # Methods emptyTM :: GenMap m a Source # lookupTM :: Key (GenMap m) -> GenMap m b -> Maybe b Source # alterTM :: Key (GenMap m) -> XT b -> GenMap m b -> GenMap m b Source # mapTM :: (a -> b) -> GenMap m a -> GenMap m b Source # filterTM :: (a -> Bool) -> GenMap m a -> GenMap m a Source # foldTM :: (a -> b -> b) -> GenMap m a -> b -> b Source #
Outputable a => Outputable (TypeMapG a) # |
Instance details Defined in GHC.Core.Map.Type Methods ppr :: TypeMapG a -> SDoc Source #
(Outputable a, Outputable (m a)) => Outputable (GenMap m a) # |
Instance details Defined in GHC.Data.TrieMap Methods ppr :: GenMap m a -> SDoc Source #
type Key (GenMap m) # |
Instance details Defined in GHC.Data.TrieMap type Key (GenMap m) = Key m

lkG :: (Eq (Key m), TrieMap m) => Key m -> GenMap m a -> Maybe a Source #

xtG :: (Eq (Key m), TrieMap m) => Key m -> XT a -> GenMap m a -> GenMap m a Source #

mapG :: TrieMap m => (a -> b) -> GenMap m a -> GenMap m b Source #

fdG :: TrieMap m => (a -> b -> b) -> GenMap m a -> b -> b Source #

xtList :: TrieMap m => (forall b. k -> XT b -> m b -> m b) -> [k] -> XT a -> ListMap m a -> ListMap m a Source #

lkList :: TrieMap m => (forall b. k -> m b -> Maybe b) -> [k] -> ListMap m a -> Maybe a Source #