[GHC] #10867: Primop types should not mention ()
GHC
ghc-devs at haskell.org
Fri Sep 11 19:11:59 UTC 2015
#10867: Primop types should not mention ()
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by simonmar):
The RTS refers to lots of things that are defined in Haskell,
incidentally, not just in primops. The full list is in `rts/Prelude.h`.
But you can change these primops if necessary. You probably didn't find
the implementations because they're Z-encoded; `finalizeWeak#` is
`stg_finalizzeWeakzh` in `rts/PrimOps.h`. It returns the finalizer of a
weak pointer, which has type `State# RealWorld -> (# State# RealWorld, ()
#)`, but you could always lie and give it a more general type. The
wrapper in `GHC.Weak` will probably work unchanged. We already lie in the
type of `mkWeak#` in a similar way, for reasons I forget.
It looks like `check#` has the wrong type anyway, its implementation
returns `()` (ie. zero return values in Cmm), so its Haskell type should
have a return type of `State# RealWorld`. Feel free to change its name at
the same time, I agree it's a silly name! When changing this you'll need
to run the tests in the stm package, which I think aren't run by default.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10867#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list