summaryrefslogtreecommitdiff
path: root/compiler/prelude
diff options
context:
space:
mode:
authorFacundo Domínguez <facundo.dominguez@tweag.io>2016-02-25 14:33:43 +0100
committerBen Gamari <ben@smart-cactus.org>2016-02-25 15:41:28 +0100
commitc1efdcc40209bc4f0ded85269eb8ba49c7d1ff09 (patch)
tree41ae9ba115d2540b7fa80cd7146ce7efbbc34eeb /compiler/prelude
parent009a99979437314a4cefa07b55a80fd13ea07c8c (diff)
downloadhaskell-c1efdcc40209bc4f0ded85269eb8ba49c7d1ff09.tar.gz
Overload the static form to reduce verbosity.
Static pointers are rarely used naked: most often they are defined at the base of a Closure, as defined in e.g. the distributed-closure and distributed-static packages. So a typical usage pattern is: distributeMap (closure (static (\x -> x * 2))) which is more verbose than it needs to be. Ideally we'd just have to write distributeMap (static (\x -> x * 2)) and let the static pointer be lifted to a Closure implicitly. i.e. what we want is to overload static literals, just like we already overload list literals and string literals. This is achieved by introducing the IsStatic type class and changing the typing rule for static forms slightly: static (e :: t) :: IsStatic p => p t Test Plan: ./validate Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: simonpj, mboes, thomie Differential Revision: https://phabricator.haskell.org/D1923 GHC Trac Issues: #11585
Diffstat (limited to 'compiler/prelude')
-rw-r--r--compiler/prelude/PrelNames.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs
index 068f276d05..cc18398ecb 100644
--- a/compiler/prelude/PrelNames.hs
+++ b/compiler/prelude/PrelNames.hs
@@ -371,6 +371,7 @@ basicKnownKeyNames
-- StaticPtr
, staticPtrTyConName
, staticPtrDataConName, staticPtrInfoDataConName
+ , fromStaticPtrName
-- Fingerprint
, fingerprintDataConName
@@ -1382,6 +1383,10 @@ staticPtrDataConName :: Name
staticPtrDataConName =
dcQual gHC_STATICPTR (fsLit "StaticPtr") staticPtrDataConKey
+fromStaticPtrName :: Name
+fromStaticPtrName =
+ varQual gHC_STATICPTR (fsLit "fromStaticPtr") fromStaticPtrClassOpKey
+
fingerprintDataConName :: Name
fingerprintDataConName =
dcQual gHC_FINGERPRINT_TYPE (fsLit "Fingerprint") fingerprintDataConKey
@@ -2184,6 +2189,9 @@ emptyCallStackKey, pushCallStackKey :: Unique
emptyCallStackKey = mkPreludeMiscIdUnique 517
pushCallStackKey = mkPreludeMiscIdUnique 518
+fromStaticPtrClassOpKey :: Unique
+fromStaticPtrClassOpKey = mkPreludeMiscIdUnique 519
+
{-
************************************************************************
* *