diff options
author | Ian Lynagh <igloo@earth.li> | 2009-11-24 01:13:13 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2009-11-24 01:13:13 +0000 |
commit | ae6378d0e49a3ffb68c58fb71dfa01ae13bd680f (patch) | |
tree | 6854124c449dcaf9e6c845c461a387dfa992ab04 | |
parent | 0dcea0d97a4bc0b1d5818faded64944fba5a29ec (diff) | |
download | haskell-ae6378d0e49a3ffb68c58fb71dfa01ae13bd680f.tar.gz |
Treat () as an enumeration tycon
This fixes deriving Ord (), which previously failed with
ghc-stage1: panic! (the 'impossible' happened)
(GHC version 6.13.20091123 for x86_64-unknown-linux):
TcGenDeriv:mk_FunBind
-rw-r--r-- | compiler/types/TyCon.lhs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/types/TyCon.lhs b/compiler/types/TyCon.lhs index 43fb524297..958a0cb8a2 100644 --- a/compiler/types/TyCon.lhs +++ b/compiler/types/TyCon.lhs @@ -864,6 +864,7 @@ isGadtSyntaxTyCon _ = False -- | Is this an algebraic 'TyCon' which is just an enumeration of values? isEnumerationTyCon :: TyCon -> Bool isEnumerationTyCon (AlgTyCon {algTcRhs = DataTyCon { is_enum = res }}) = res +isEnumerationTyCon (TupleTyCon {tyConArity = arity}) = arity == 0 isEnumerationTyCon _ = False -- | Is this a 'TyCon', synonym or otherwise, that may have further instances appear? @@ -1093,8 +1094,9 @@ tyConFamilySize other = pprPanic "tyConFamilySize:" (ppr other) -- | Extract an 'AlgTyConRhs' with information about data constructors from an algebraic or tuple -- 'TyCon'. Panics for any other sort of 'TyCon' algTyConRhs :: TyCon -> AlgTyConRhs -algTyConRhs (AlgTyCon {algTcRhs = rhs}) = rhs -algTyConRhs (TupleTyCon {dataCon = con}) = DataTyCon { data_cons = [con], is_enum = False } +algTyConRhs (AlgTyCon {algTcRhs = rhs}) = rhs +algTyConRhs (TupleTyCon {dataCon = con, tyConArity = arity}) + = DataTyCon { data_cons = [con], is_enum = arity == 0 } algTyConRhs other = pprPanic "algTyConRhs" (ppr other) \end{code} |