From cbe382d4ff5a37d38a56aa346b9d229d336f16b4 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Tue, 26 Oct 2010 07:04:05 +0000 Subject: [PATCH] Make isIrrefutableHsPat say True for existentials; fixes Trac #4439 At last. A bug that is really easy to fix. --- compiler/hsSyn/HsPat.lhs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/hsSyn/HsPat.lhs b/compiler/hsSyn/HsPat.lhs index 1bf0aa8..25a350b 100644 --- a/compiler/hsSyn/HsPat.lhs +++ b/compiler/hsSyn/HsPat.lhs @@ -47,6 +47,7 @@ import SrcLoc import FastString -- libraries: import Data.Data hiding (TyCon) +import Data.Maybe \end{code} @@ -411,7 +412,9 @@ isIrrefutableHsPat pat go1 (ConPatIn {}) = False -- Conservative go1 (ConPatOut{ pat_con = L _ con, pat_args = details }) - = isProductTyCon (dataConTyCon con) + = isJust (tyConSingleDataCon_maybe (dataConTyCon con)) + -- NB: tyConSingleDataCon_maybe, *not* isProductTyCon, because + -- the latter is false of existentials. See Trac #4439 && all go (hsConPatArgs details) go1 (LitPat {}) = False -- 1.7.10.4