[Git][ghc/ghc][wip/andreask/typedUniqFM] Expand map types haddocks
Andreas Klebinger
gitlab at gitlab.haskell.org
Tue Jun 23 20:53:12 UTC 2020
Andreas Klebinger pushed to branch wip/andreask/typedUniqFM at Glasgow Haskell Compiler / GHC
Commits:
36db8a56 by Andreas Klebinger at 2020-06-23T22:52:41+02:00
Expand map types haddocks
- - - - -
2 changed files:
- compiler/GHC/Types/Unique/DFM.hs
- compiler/GHC/Types/Unique/FM.hs
Changes:
=====================================
compiler/GHC/Types/Unique/DFM.hs
=====================================
@@ -129,6 +129,12 @@ instance Eq val => Eq (TaggedVal val) where
(TaggedVal v1 _) == (TaggedVal v2 _) = v1 == v2
-- | Type of unique deterministic finite maps
+--
+-- The key is just here to keep us honest. It's always safe
+-- to use a single type as key.
+-- If two types don't overlap in their uniques it's also safe
+-- to index the same map at multiple key types. But this is
+-- very much discouraged.
data UniqDFM key ele =
UDFM
!(M.IntMap (TaggedVal ele)) -- A map where keys are Unique's values and
=====================================
compiler/GHC/Types/Unique/FM.hs
=====================================
@@ -85,7 +85,14 @@ import Data.Data
import qualified Data.Semigroup as Semi
import Data.Functor.Classes (Eq1 (..))
-
+-- | A finite map from @uniques@ of one type to
+-- elements in another type.
+--
+-- The key is just here to keep us honest. It's always safe
+-- to use a single type as key.
+-- If two types don't overlap in their uniques it's also safe
+-- to index the same map at multiple key types. But this is
+-- very much discouraged.
newtype UniqFM key ele = UFM (M.IntMap ele)
deriving (Data, Eq, Functor)
-- Nondeterministic Foldable and Traversable instances are accessible through
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/36db8a56a87acedd8c6d5e2460cc220f94d6bca4
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/36db8a56a87acedd8c6d5e2460cc220f94d6bca4
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200623/f734525f/attachment-0001.html>
More information about the ghc-commits
mailing list