Closed conal closed 10 years ago
The scrutinee of the case ($W:< Int Z (I# 10) ($WZVec Int)
) is a function application. If you:
hermit<2> down
$W:< Int Z (I# 10) ($WZVec Int)
hermit<3> unfold
(:<) (S Z) Int Z ■ (I# 10) ($WZVec Int)
hermit<4> up
case (:<) (S Z) Int Z ■ (I# 10) ($WZVec Int) of wild Int
_ → (λ ds → patError Int ("GADT.hs:41:1-18|function headV"#)) void#
(:<) n □ x ds → x
hermit<5> case-reduce
I# 10
Things work. We have a case-reduce-id command that inlines a scrutinee that is a single identifier, so I just added a case-reduce-unfold equivalent in 2ea8edbb6d52fd9f726dee62257daeef0a2d687a. (Really, case-reduce-unfold subsumes case-reduce-id, but the latter is used in some scripts, so I won't remove it just now.)
Oh! Got it. Thanks a bunch.
I see that caseReduceFoldR
takes a flag saying whether to substitute (vs build a let
). If subst
is True
, might we get replicated non-trivial computation? What are the trade-offs?
I agree, case-reduce-unfold does subsume case-reduce-id. The only place I was using it was in bash and smash, so I've now replaced that usage with case-reduce-unfold, and removed case-reduce-id entirely.
Case reduction fails in the following example (with a GADT):