diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-04-19 14:11:40 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-09-22 12:57:32 -0400 |
commit | 4f48b4949b7907772387d0f581001beb75bfd066 (patch) | |
tree | fb493e93abe09e94ed65f1bf7d2267c08a88aaf8 | |
parent | d54f9bf9c1b9ca73331e3262f3c7a99402a43018 (diff) | |
download | haskell-4f48b4949b7907772387d0f581001beb75bfd066.tar.gz |
compiler/FamInstEnv: Various documentation fixes
(cherry picked from commit 10d50b1fb79db5d16276a16af182fd236a163a0b)
-rw-r--r-- | compiler/types/FamInstEnv.hs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/compiler/types/FamInstEnv.hs b/compiler/types/FamInstEnv.hs index 37bb7f0144..269435f5d3 100644 --- a/compiler/types/FamInstEnv.hs +++ b/compiler/types/FamInstEnv.hs @@ -5,11 +5,13 @@ {-# LANGUAGE CPP, GADTs, ScopedTypeVariables, BangPatterns, TupleSections #-} module FamInstEnv ( + -- * Family instances FamInst(..), FamFlavor(..), famInstAxiom, famInstTyCon, famInstRHS, famInstsRepTyCons, famInstRepTyCon_maybe, dataFamInstRepTyCon, pprFamInst, pprFamInsts, mkImportedFamInst, + -- * Family instance environment FamInstEnvs, FamInstEnv, emptyFamInstEnv, emptyFamInstEnvs, extendFamInstEnv, extendFamInstEnvList, famInstEnvElts, famInstEnvSize, familyInstances, @@ -18,21 +20,22 @@ module FamInstEnv ( mkCoAxBranch, mkBranchedCoAxiom, mkUnbranchedCoAxiom, mkSingleCoAxiom, mkNewTypeCoAxiom, + -- * Family instance lookup FamInstMatch(..), lookupFamInstEnv, lookupFamInstEnvConflicts, lookupFamInstEnvByTyCon, isDominatedBy, apartnessCheck, - -- Injectivity + -- * Injectivity InjectivityCheckResult(..), lookupFamInstEnvInjectivityConflicts, injectiveBranches, - -- Normalisation + -- * Normalisation topNormaliseType, topNormaliseType_maybe, normaliseType, normaliseTcApp, normaliseTcArgs, reduceTyFamApp_maybe, - -- Flattening + -- * Flattening flattenTys ) where @@ -350,7 +353,7 @@ UniqFM and UniqDFM. See Note [Deterministic UniqFM]. -} -type FamInstEnv = UniqDFM FamilyInstEnv -- Maps a family to its instances +type FamInstEnv = UniqDFM FamilyInstEnv -- ^ Maps a family to its instances -- See Note [FamInstEnv] -- See Note [FamInstEnv determinism] @@ -764,6 +767,7 @@ lookupFamInstEnvByTyCon (pkg_ie, home_ie) fam_tc Nothing -> [] Just (FamIE fis) -> fis +-- | Look-up an instance for a type family applied to some types. lookupFamInstEnv :: FamInstEnvs -> TyCon -> [Type] -- What we are looking for @@ -775,10 +779,11 @@ lookupFamInstEnv where match _ _ tpl_tys tys = tcMatchTys tpl_tys tys +-- | Find instances in 'FamInstEnvs' which conflict with a new 'FamInst'. lookupFamInstEnvConflicts :: FamInstEnvs - -> FamInst -- Putative new instance - -> [FamInstMatch] -- Conflicting matches (don't look at the fim_tys field) + -> FamInst -- ^ Putative new instance + -> [FamInstMatch] -- ^ Conflicting matches (don't look at the fim_tys field) -- E.g. when we are about to add -- f : type instance F [a] = a->a -- we do (lookupFamInstConflicts f [b]) |