Core, Unit and Z0T

Tobias Gedell d99getob at dtek.chalmers.se
Thu Jan 30 13:49:34 EST 2003


Are Unit and Z0T considered equal?


In GHC/Base.hcr they are both defined:

-----
   %data GHCziBase.Unit =
     {GHCziBase.Unit};
   %data GHCziBase.Z0T =
     {GHCziBase.Z0T};
-----


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 #)) #)
    with
    usage            = { mangle FinalizeWeakOp [mkM, mkP]
                                (mkR . (inUB FinalizeWeakOp
                                             [id,id,inFun FinalizeWeakOp 
mkR mkM])) }
    has_side_effects = True
    out_of_line      = True
-----

Here Unit is used but in .../GHC/Weak.hcr at line 57 when using 
GHCziPrim.finalizzeWeakzh it is tried to unify with Z0T:

-----
   GHCziWeak.finalizze :: %forall v . GHCziWeak.Weak v ->
				     GHCziIOBase.IO GHCziBase.Z0T =
     \ @ v
       (ds::GHCziWeak.Weak v)
       (eta::GHCziPrim.Statezh GHCziPrim.RealWorld) ->
	%case ds %of (wild::GHCziWeak.Weak v)
	  {GHCziWeak.Weak (w::GHCziPrim.Weakzh v) ->
	     %case (GHCziPrim.finalizzeWeakzh @ v w eta)
	     %of (wild1::GHCziPrim.Z3H
			 (GHCziPrim.Statezh GHCziPrim.RealWorld)
			 GHCziPrim.Intzh
			 (GHCziPrim.Statezh GHCziPrim.RealWorld ->
			  GHCziPrim.Z2H
			  (GHCziPrim.Statezh GHCziPrim.RealWorld)
			  GHCziBase.Z0T))
-----


I have looked around a bit and tried to see if there is any 
documentation that says that Unit and Z0T are the same but I didn't find 
any.



Sincerely,
  Tobias




More information about the Glasgow-haskell-bugs mailing list