Primop types should not mention ()
I've just noticed that two primpops have types that mention tuples (see compiler/prelude/primops.txt.pp
):
primop FinalizeWeakOp "finalizeWeak#" GenPrimOp
Weak# a -> State# RealWorld -> (# State# RealWorld, Int#,
(State# RealWorld -> (# State# RealWorld, () #)) #)
primop Check "check#" GenPrimOp
(State# RealWorld -> (# State# RealWorld, a #) )
-> (State# RealWorld -> (# State# RealWorld, () #) )
But they really really shouldn't. The unit tuple is a type defined in Haskell, and it makes an awkward cycle if the supposedly-truly-primitive primpops refer to it. (Discovered during the saga of [D757].)
Most primpops do not do this; eg
primop WriteMutVarOp "writeMutVar#" GenPrimOp
MutVar# s a -> a -> State# s -> State# s
Now check#
and finalizeWeak#
are pretty obscure primops and I don't think anyone will mind if I fix their type signatures.
But in addition to doing that, I'll have to look at their implementations. 'But where are those implementations??' I can't find anything in the RTS.
While thinking about it
- Both come with literally zero Haddock documentation which is terrible. The type of both is pretty obscure.
-
check#
is a very short name for very specialised STM operation. Surely we should call itaddSTMInvariant
or something like that?
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | fryguybob |
Operating system | |
Architecture |