Core, Unit and Z0T
Simon Peyton-Jones
simonpj at microsoft.com
Fri Jan 31 04:06:07 EST 2003
| Are Unit and Z0T considered equal?
No, the are not. Z0T is the zero-tuple type ()
Unit is used only in generic programming, and can be written "1" (in
types)>
| In GHC/Base.hcr they are both defined:
|
| -----
| %data GHCziBase.Unit =
| {GHCziBase.Unit};
| %data GHCziBase.Z0T =
| {GHCziBase.Z0T};
That's right
| In .../ghc/compiler/prelude/primops.txt at line 2669 we find:
|
| -----
| primop FinalizeWeakOp "finalizeWeak#" GenPrimOp
| Weak# a -> State# RealWorld -> (# State# RealWorld, Int#,
| (State# RealWorld -> (# State# RealWorld, Unit #)) #)
OK, this is where the wierdness is. The "Unit" here should probably be
"()". When
processed into Haskell to give the type of finalizeWeak#, the Unit
becomes unitTy,
and that in turn is defined in prelude/TysWiredIn to be the zero-tuple
type ().
So primops.txt is very misleading here. I'll fix it to use () instead.
Simon
More information about the Glasgow-haskell-bugs
mailing list