-
Notifications
You must be signed in to change notification settings - Fork 8
Support static pointers #11
Support static pointers #11
Conversation
This relies on a very minor extension to the Note that I have not bumped version numbers on either package as part of the PR. |
(By the way, it doesn't mean we don't need remote tables anymore, of course, because CH internationally still relies on them, as does, incidentally, distributed-static itself. It does however mean we don't need any additional remote tables are calls to |
Whoops, missing some CPP somewhere for older CPP. Will fix. |
And add a travis config for 7.10 |
Ok, added 7.10 to the travis and fixed build on < 7.10. |
What's |
@mboes It's proposed at https://ghc.haskell.org/trac/ghc/wiki/TypeableT ; I have to say I'm not convinced by it myself so far. |
Don't bother with .travis.yml, or consider using this commit eb0cdfc Wait, actually. I'll merge that right now. |
Ok, removed the change to the travis config. |
LGTM. I don't like much having to encode and decode the typerep on every use of a static pointer, but I see no better way to avoid crashes when the user gets the type index wrong. |
) | ||
|
||
-- Imports necessary to support StaticPtr | ||
#if __GLASGOW_HASKELL__ >= 710 | ||
import qualified GHC.Prim as GHC (Any) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be imported as GHC.Exts(Any)
and it would allow to drop the dependency on ghc-prim
, I think.
Ok, changed import to |
We can add support for static pointers in a fully backwards compatible way; we do not even need to bump the major version number on the package. All we are doing is adding an additional constructor to
StaticLabel
. Once all the work onpolystatic
(however it gets resolved eventually) and the new structure of the SPT is implemented in GHC, we probably want to modify this implementation, but until that time we can make use of the new static pointers extension right now. Being able to avoidremotable
and co makes life a lot easier. I've tested this in a Cloud Haskell application we're developing and it seems to work very well. It's certainly cleaned out code up nicely.Note that even if we change the internal implementation, the user facing API that this PR provides is the right one:
This will not need to change even when the underlying mechanisms change.