| ... |
... |
@@ -45,7 +45,7 @@ import GHC.Types.Name |
|
45
|
45
|
import GHC.Types.Name.Env
|
|
46
|
46
|
import GHC.Types.Var
|
|
47
|
47
|
import GHC.Types.Var.Env
|
|
48
|
|
-import GHC.Types.Unique.FM
|
|
|
48
|
+import GHC.Types.Unique.DFM
|
|
49
|
49
|
import GHC.Utils.Outputable
|
|
50
|
50
|
|
|
51
|
51
|
import GHC.Utils.Panic
|
| ... |
... |
@@ -365,14 +365,14 @@ filterT f (TM { tm_var = tvar, tm_app = tapp, tm_tycon = ttycon |
|
365
|
365
|
|
|
366
|
366
|
------------------------
|
|
367
|
367
|
data TyLitMap a = TLM { tlm_number :: Map.Map Integer a
|
|
368
|
|
- , tlm_string :: UniqFM FastString a
|
|
|
368
|
+ , tlm_string :: UniqDFM FastString a
|
|
369
|
369
|
, tlm_char :: Map.Map Char a
|
|
370
|
370
|
}
|
|
371
|
371
|
|
|
372
|
372
|
-- TODO(22292): derive
|
|
373
|
373
|
instance Functor TyLitMap where
|
|
374
|
374
|
fmap f TLM { tlm_number = tn, tlm_string = ts, tlm_char = tc } = TLM
|
|
375
|
|
- { tlm_number = Map.map f tn, tlm_string = mapUFM f ts, tlm_char = Map.map f tc }
|
|
|
375
|
+ { tlm_number = Map.map f tn, tlm_string = mapUDFM f ts, tlm_char = Map.map f tc }
|
|
376
|
376
|
|
|
377
|
377
|
instance TrieMap TyLitMap where
|
|
378
|
378
|
type Key TyLitMap = TyLit
|
| ... |
... |
@@ -384,34 +384,34 @@ instance TrieMap TyLitMap where |
|
384
|
384
|
mapMaybeTM = mpTyLit
|
|
385
|
385
|
|
|
386
|
386
|
emptyTyLitMap :: TyLitMap a
|
|
387
|
|
-emptyTyLitMap = TLM { tlm_number = Map.empty, tlm_string = emptyUFM, tlm_char = Map.empty }
|
|
|
387
|
+emptyTyLitMap = TLM { tlm_number = Map.empty, tlm_string = emptyUDFM, tlm_char = Map.empty }
|
|
388
|
388
|
|
|
389
|
389
|
lkTyLit :: TyLit -> TyLitMap a -> Maybe a
|
|
390
|
390
|
lkTyLit l =
|
|
391
|
391
|
case l of
|
|
392
|
392
|
NumTyLit n -> tlm_number >.> Map.lookup n
|
|
393
|
|
- StrTyLit n -> tlm_string >.> (`lookupUFM` n)
|
|
|
393
|
+ StrTyLit n -> tlm_string >.> (`lookupUDFM` n)
|
|
394
|
394
|
CharTyLit n -> tlm_char >.> Map.lookup n
|
|
395
|
395
|
|
|
396
|
396
|
xtTyLit :: TyLit -> XT a -> TyLitMap a -> TyLitMap a
|
|
397
|
397
|
xtTyLit l f m =
|
|
398
|
398
|
case l of
|
|
399
|
399
|
NumTyLit n -> m { tlm_number = Map.alter f n (tlm_number m) }
|
|
400
|
|
- StrTyLit n -> m { tlm_string = alterUFM f (tlm_string m) n }
|
|
|
400
|
+ StrTyLit n -> m { tlm_string = alterUDFM f (tlm_string m) n }
|
|
401
|
401
|
CharTyLit n -> m { tlm_char = Map.alter f n (tlm_char m) }
|
|
402
|
402
|
|
|
403
|
403
|
foldTyLit :: (a -> b -> b) -> TyLitMap a -> b -> b
|
|
404
|
|
-foldTyLit l m = flip (nonDetFoldUFM l) (tlm_string m)
|
|
|
404
|
+foldTyLit l m = flip (foldUDFM l) (tlm_string m)
|
|
405
|
405
|
. flip (Map.foldr l) (tlm_number m)
|
|
406
|
406
|
. flip (Map.foldr l) (tlm_char m)
|
|
407
|
407
|
|
|
408
|
408
|
filterTyLit :: (a -> Bool) -> TyLitMap a -> TyLitMap a
|
|
409
|
409
|
filterTyLit f (TLM { tlm_number = tn, tlm_string = ts, tlm_char = tc })
|
|
410
|
|
- = TLM { tlm_number = Map.filter f tn, tlm_string = filterUFM f ts, tlm_char = Map.filter f tc }
|
|
|
410
|
+ = TLM { tlm_number = Map.filter f tn, tlm_string = filterUDFM f ts, tlm_char = Map.filter f tc }
|
|
411
|
411
|
|
|
412
|
412
|
mpTyLit :: (a -> Maybe b) -> TyLitMap a -> TyLitMap b
|
|
413
|
413
|
mpTyLit f (TLM { tlm_number = tn, tlm_string = ts, tlm_char = tc })
|
|
414
|
|
- = TLM { tlm_number = Map.mapMaybe f tn, tlm_string = mapMaybeUFM f ts, tlm_char = Map.mapMaybe f tc }
|
|
|
414
|
+ = TLM { tlm_number = Map.mapMaybe f tn, tlm_string = mapMaybeUDFM f ts, tlm_char = Map.mapMaybe f tc }
|
|
415
|
415
|
|
|
416
|
416
|
-------------------------------------------------
|
|
417
|
417
|
-- | @TypeMap a@ is a map from 'Type' to @a@. If you are a client, this
|