summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Jakobi <simon.jakobi@gmail.com>2018-04-02 22:27:44 +0200
committerBen Gamari <ben@smart-cactus.org>2018-04-07 13:30:15 -0400
commit7bd7fecbc9819adfb097aab5fa7e0fe1cdf1cefd (patch)
tree900ac894a0d4375041cbb9878c49b86cf221af0f
parent26cfe291c5d581299a40ae5177979ddf1b465ec0 (diff)
downloadhaskell-7bd7fecbc9819adfb097aab5fa7e0fe1cdf1cefd.tar.gz
Improve documentation for refineDefaultAlt
-rw-r--r--compiler/coreSyn/CoreUtils.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs
index 5608afc334..792da99f38 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.