-
- core_if <- matchEnvStack env_ids stack_ids
- (mkIfThenElse core_cond
- (left_expr then_ty else_ty (buildEnvStack then_ids stack_ids))
- (right_expr then_ty else_ty (buildEnvStack else_ids stack_ids)))
+
+ core_left = mk_left_expr then_ty else_ty (buildEnvStack then_ids stack_ids)
+ core_right = mk_right_expr then_ty else_ty (buildEnvStack else_ids stack_ids)
+
+ core_if <- case mb_fun of
+ Just fun -> do { core_fun <- dsExpr fun
+ ; matchEnvStack env_ids stack_ids $
+ mkCoreApps core_fun [core_cond, core_left, core_right] }
+ Nothing -> matchEnvStack env_ids stack_ids $
+ mkIfThenElse core_cond core_left core_right
+