Add ad-hoc typing checks for tagToEnum#
authorsimonpj@microsoft.com <unknown>
Wed, 16 Aug 2006 20:31:56 +0000 (20:31 +0000)
committersimonpj@microsoft.com <unknown>
Wed, 16 Aug 2006 20:31:56 +0000 (20:31 +0000)
commitc938c386fe84f9203c992bb35508c7a5b35bb22c
tree421b6fa6fe831be660605deb09d42c574dc396cb
parentc55001c567b4f6e17f7a0c174c003318aac6a8ed
Add ad-hoc typing checks for tagToEnum#

The problem with tagToEnum# is that it is not overloaded (in the
Haskell sense) but you are only supposed to apply it to a TyCon
that is an enumeration (isEnumerationTyCon).

The Real Way to do this is to have some special kind of type constraint
for the purpose, but that is wild overkill. So this patch adds a small
rather ad-hoc check to TcExpr.instFun.  Crude, simple, but it works fine.

Fixes Trac #786
Test is tcfail164
compiler/prelude/PrelRules.lhs
compiler/prelude/PrimOp.lhs
compiler/typecheck/TcExpr.lhs