- charge 1 for a case expression
- give a discount of opt_UF_ScrutConDiscount each time a constructor
is scrutinised
(previously a case expression was not charged for at all, and the
discount for a scrutinised constructor was (opt_UF_ScrutConDiscount *
tyconFamilySize). In 4.02, a case expression was also charged
tyconFamilySize to balance the discount, but this had the disadvantage
of charging for alternatives which may not be present in the actual
case expression).
discount_for b
| num_cases == 0 = 0
| is_fun_ty = num_cases * opt_UF_FunAppDiscount
discount_for b
| num_cases == 0 = 0
| is_fun_ty = num_cases * opt_UF_FunAppDiscount
- | is_data_ty = num_cases * tyConFamilySize tycon * opt_UF_ScrutConDiscount
+ | is_data_ty = num_cases * opt_UF_ScrutConDiscount
| otherwise = num_cases * opt_UF_PrimArgDiscount
where
num_cases = foldlBag (\n b' -> if b==b' then n+1 else n) 0 cased_args
| otherwise = num_cases * opt_UF_PrimArgDiscount
where
num_cases = foldlBag (\n b' -> if b==b' then n+1 else n) 0 cased_args
= nukeScrutDiscount (size_up scrut) `addSize`
arg_discount scrut `addSize`
foldr (addSize . size_up_alt) sizeZero alts
= nukeScrutDiscount (size_up scrut) `addSize`
arg_discount scrut `addSize`
foldr (addSize . size_up_alt) sizeZero alts
+ `addSizeN` 1 -- charge one for the case itself.
-- Just charge for the alts that exist, not the ones that might exist
-- `addSizeN`
-- Just charge for the alts that exist, not the ones that might exist
-- `addSizeN`