logo       

RE: Core, Unit and Z0T: msg#00075

lang.haskell.glasgow.bugs

Subject: RE: Core, Unit and Z0T

| 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


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise