
#11526: unsafeLookupStaticPtr should not live in IO -------------------------------------+------------------------------------- Reporter: edsko | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Core Libraries | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by edsko):
Hmm. I'm deeply suspicious of `StaticKey` . It plays no role in our plan of record StaticPointers. If we don't have `StaticKey` the whole issue doesn't arise.
`StaticKey` is a low-level implementation detail. I have just added support for static pointers to the existing `distributed-static` package, based on the support for static pointers that exists in ghc today. The higher level API that `distributed-static` exposes is simply that `Static a` has a `Binary` instance (for `Typeable a`). But this is precisely where the problem is: if looking up a static pointer is not pure, then we cannot give a `Binary` instance. Facundo's objection is that in fact looking up a static pointer ''isn't'' pure. If that is true, then `unsafeLookupStaticPtr` should indeed live in IO, but then not having `StaticKey` is not going to solve the problem, it's just going to move it: whatever shape the decoder of `Static` takes (`Binary` instance, separate function, ...) will have to deal with it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11526#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler