At last. A bug that is really easy to fix.
import FastString
-- libraries:
import Data.Data hiding (TyCon)
+import Data.Maybe
\end{code}
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