summaryrefslogtreecommitdiff
path: root/compiler/simplCore
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-11-11 12:34:42 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-12-03 21:04:50 -0500
commit25019d18109cd620a2cf6ab0e7d417d14935e8a5 (patch)
treea81dc696bd36a9e3669f49936c5f3533d633805f /compiler/simplCore
parent10caee7fd3f048ead668e8bc70d855d9a55f89a5 (diff)
downloadhaskell-25019d18109cd620a2cf6ab0e7d417d14935e8a5.tar.gz
Drop Uniquable constraint for AnnTarget
This relied on deriveUnique, which was far too subtle to be safely applied. Thankfully the instance doesn't appear to be used so let's just drop it.
Diffstat (limited to 'compiler/simplCore')
-rw-r--r--compiler/simplCore/CoreMonad.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs
index fde925063b..c87bd353c0 100644
--- a/compiler/simplCore/CoreMonad.hs
+++ b/compiler/simplCore/CoreMonad.hs
@@ -64,10 +64,12 @@ import FastString
import qualified ErrUtils as Err
import ErrUtils( Severity(..) )
import UniqSupply
-import UniqFM ( UniqFM, mapUFM, filterUFM )
+import NameEnv ( mapNameEnv, filterNameEnv )
import MonadUtils
import NameCache
+import NameEnv
import SrcLoc
+import Data.Bifunctor ( bimap )
import Data.List
import Data.Ord
import Data.Dynamic
@@ -733,17 +735,19 @@ getPackageFamInstEnv = do
-- annotations.
--
-- See Note [Annotations]
-getAnnotations :: Typeable a => ([Word8] -> a) -> ModGuts -> CoreM (UniqFM [a])
+getAnnotations :: Typeable a => ([Word8] -> a) -> ModGuts -> CoreM (ModuleEnv [a], NameEnv [a])
getAnnotations deserialize guts = do
hsc_env <- getHscEnv
ann_env <- liftIO $ prepareAnnotations hsc_env (Just guts)
return (deserializeAnns deserialize ann_env)
--- | Get at most one annotation of a given type per Unique.
-getFirstAnnotations :: Typeable a => ([Word8] -> a) -> ModGuts -> CoreM (UniqFM a)
+-- | Get at most one annotation of a given type per annotatable item.
+getFirstAnnotations :: Typeable a => ([Word8] -> a) -> ModGuts -> CoreM (ModuleEnv a, NameEnv a)
getFirstAnnotations deserialize guts
- = liftM (mapUFM head . filterUFM (not . null))
- $ getAnnotations deserialize guts
+ = bimap mod name <$> getAnnotations deserialize guts
+ where
+ mod = mapModuleEnv head . filterModuleEnv (const $ not . null)
+ name = mapNameEnv head . filterNameEnv (not . null)
{-
Note [Annotations]