Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Support static pointers #11

Merged
merged 1 commit into from
Feb 5, 2016
Merged

Support static pointers #11

merged 1 commit into from
Feb 5, 2016

Conversation

edsko
Copy link
Member

@edsko edsko commented Feb 1, 2016

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 on polystatic (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 avoid remotable 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:

staticPtr :: forall a. Typeable a => StaticPtr a -> Static a

This will not need to change even when the underlying mechanisms change.

@edsko
Copy link
Member Author

edsko commented Feb 1, 2016

This relies on a very minor extension to the rank1dynamic package: haskell-distributed/rank1dynamic#13 .

Note that I have not bumped version numbers on either package as part of the PR.

@edsko
Copy link
Member Author

edsko commented Feb 1, 2016

(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 remotable in applications that don't mind insisting on ghc >= 7.10).

@edsko
Copy link
Member Author

edsko commented Feb 1, 2016

Whoops, missing some CPP somewhere for older CPP. Will fix.

@dcoutts
Copy link
Member

dcoutts commented Feb 1, 2016

And add a travis config for 7.10

@edsko
Copy link
Member Author

edsko commented Feb 1, 2016

Ok, added 7.10 to the travis and fixed build on < 7.10.

@mboes
Copy link
Contributor

mboes commented Feb 1, 2016

What's polystatic?

@edsko
Copy link
Member Author

edsko commented Feb 1, 2016

@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.

@facundominguez
Copy link
Contributor

Don't bother with .travis.yml, or consider using this commit eb0cdfc

Wait, actually. I'll merge that right now.
Done.

@edsko
Copy link
Member Author

edsko commented Feb 1, 2016

Ok, removed the change to the travis config.

@facundominguez
Copy link
Contributor

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)
Copy link
Contributor

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.

@edsko
Copy link
Member Author

edsko commented Feb 2, 2016

Ok, changed import to GHC.Exts and removed ghc-prim from dependency list in the cabal file.

facundominguez added a commit that referenced this pull request Feb 5, 2016
@facundominguez facundominguez merged commit 8943054 into haskell-distributed:master Feb 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants