
#10867: Primop types should not mention () -------------------------------------+------------------------------------- Reporter: simonpj | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- 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 [Phab: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 it `addSTMInvariant` or something like that? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10867 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler