Wed Oct 18 04:56:58 PDT 2006 [EMAIL PROTECTED]
* Add the primitive type Any, and use it for Dynamics
GHC's code generator can only enter a closure if it's guaranteed
not to be a function. In the Dynamic module, we were using the
type (forall a.a) as the type to which the dynamic type was unsafely
cast:
type Obj = forall a.a
Gut alas this polytype was sometimes instantiated to (), something
like this (it only bit when profiling was enabled)
let y::() = dyn ()
in (y `cast` ..) p q
As a result, an ASSERT in ClosureInfo fired (hooray).
I've tided this up by making a new, primitive, lifted type Any, and
arranging that Dynamic uses Any, thus:
type Obj = ANy
While I was at it, I also arranged that when the type checker instantiates
un-constrained type variables, it now instantiates them to Any, not ()
e.g. length Any []
[There remains a Horrible Hack when we want Any-like things at arbitrary
kinds. This essentially never happens, but see comments with
TysPrim.mkAnyPrimTyCon.]
Anyway, this fixes Trac #905
M ./compiler/codeGen/ClosureInfo.lhs -5 +5
M ./compiler/deSugar/DsBinds.lhs -4 +5
M ./compiler/iface/MkIface.lhs -11
M ./compiler/prelude/PrelNames.lhs -2 +6
M ./compiler/prelude/TysPrim.lhs -3 +54
M ./compiler/prelude/TysWiredIn.lhs -17
M ./compiler/typecheck/TcHsSyn.lhs -7 +6
M ./compiler/types/TyCon.lhs -4 +3
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc