[commit: ghc] master: Improve documentation for refineDefaultAlt (7bd7fec)
git at git.haskell.org
git at git.haskell.org
Sat Apr 7 19:44:58 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/7bd7fecbc9819adfb097aab5fa7e0fe1cdf1cefd/ghc
>---------------------------------------------------------------
commit 7bd7fecbc9819adfb097aab5fa7e0fe1cdf1cefd
Author: Simon Jakobi <simon.jakobi at gmail.com>
Date: Mon Apr 2 22:27:44 2018 +0200
Improve documentation for refineDefaultAlt
>---------------------------------------------------------------
7bd7fecbc9819adfb097aab5fa7e0fe1cdf1cefd
compiler/coreSyn/CoreUtils.hs | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs
index 5608afc..792da99 100644
--- a/compiler/coreSyn/CoreUtils.hs
+++ b/compiler/coreSyn/CoreUtils.hs
@@ -645,12 +645,13 @@ filterAlts _tycon inst_tys imposs_cons alts
impossible_alt inst_tys (DataAlt con, _, _) = dataConCannotMatch inst_tys con
impossible_alt _ _ = False
-refineDefaultAlt :: [Unique] -> TyCon -> [Type]
- -> [AltCon] -- Constructors that cannot match the DEFAULT (if any)
+-- | Refine the default alternative to a 'DataAlt', if there is a unique way to do so.
+refineDefaultAlt :: [Unique] -- ^ Uniques for constructing new binders
+ -> TyCon -- ^ Type constructor of scrutinee's type
+ -> [Type] -- ^ Type arguments of scrutinee's type
+ -> [AltCon] -- ^ Constructors that cannot match the DEFAULT (if any)
-> [CoreAlt]
- -> (Bool, [CoreAlt])
--- Refine the default alternative to a DataAlt,
--- if there is a unique way to do so
+ -> (Bool, [CoreAlt]) -- ^ 'True', if a default alt was replaced with a 'DataAlt'
refineDefaultAlt us tycon tys imposs_deflt_cons all_alts
| (DEFAULT,_,rhs) : rest_alts <- all_alts
, isAlgTyCon tycon -- It's a data type, tuple, or unboxed tuples.
More information about the ghc-commits
mailing list