+ -- Data types with a single nullary constructor
+ | (maybeToBool maybe_data_type) && -- Data type
+ (null other_data_cons) && -- Just one constr
+ (null data_con_arg_tys)
+ =
+ let unit = dataConId unitDataCon
+ scrut_ty = mkUnboxedTupleTy 1 [realWorldStatePrimTy]
+ in
+ returnDs (scrut_ty, unit, mkConApp unitDataCon [])
+ | otherwise
+ = pprPanic "boxResult: " (ppr ty)
+ where
+ maybe_data_type = splitAlgTyConApp_maybe ty
+ Just (tycon, tycon_arg_tys, data_cons) = maybe_data_type
+ (the_data_con : other_data_cons) = data_cons
+ ccall_res_type = mkUnboxedTupleTy 2
+ [realWorldStatePrimTy, the_prim_result_ty]
+
+ data_con_arg_tys = dataConArgTys the_data_con tycon_arg_tys
+ (the_prim_result_ty : other_args_tys) = data_con_arg_tys
+
+\end{code}