summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/Base.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-12-13 10:49:31 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-12-13 10:52:10 +0000
commit321b420f4582d103ca7b304867b916a749712e9f (patch)
tree2e76c23cca162b2d00da9b52c73f42bc559a0089 /libraries/base/GHC/Base.hs
parente40db7b1676627f5291b463405338e7b69fa3f69 (diff)
downloadhaskell-321b420f4582d103ca7b304867b916a749712e9f.tar.gz
Tidy up of wired-in names
Two things here: * While debugging Trac #14561 I found it hard to understand ghcPrimIds and magicIds in MkId. This patch adds more structure and comments. * I also discovered that ($) no longer needs to be a wiredInId because we now have levity polymorphism. So I took dollarId out of MkId; and gave it a levity-polymorphic type in GHC.Base
Diffstat (limited to 'libraries/base/GHC/Base.hs')
-rw-r--r--libraries/base/GHC/Base.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs
index 2d6e0e4195..35de446ca6 100644
--- a/libraries/base/GHC/Base.hs
+++ b/libraries/base/GHC/Base.hs
@@ -83,6 +83,7 @@ Other Prelude modules are much easier with fewer complex dependencies.
, UnboxedTuples
, ExistentialQuantification
, RankNTypes
+ , KindSignatures
#-}
-- -Wno-orphans is needed for things like:
-- Orphan rule: "x# -# x#" ALWAYS forall x# :: Int# -# x# x# = 0
@@ -1287,9 +1288,13 @@ flip f x y = f y x
--
-- It is also useful in higher-order situations, such as @'map' ('$' 0) xs@,
-- or @'Data.List.zipWith' ('$') fs xs@.
+--
+-- Note that @($)@ is levity-polymorphic in its result type, so that
+-- foo $ True where foo :: Bool -> Int#
+-- is well-typed
{-# INLINE ($) #-}
-($) :: (a -> b) -> a -> b
-f $ x = f x
+($) :: forall r a (b :: TYPE r). (a -> b) -> a -> b
+f $ x = f x
-- | Strict (call-by-value) application operator. It takes a function and an
-- argument, evaluates the argument to weak head normal form (WHNF), then calls