summaryrefslogtreecommitdiff
path: root/compiler/prelude
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/prelude')
-rw-r--r--compiler/prelude/PrelNames.lhs28
-rw-r--r--compiler/prelude/PrelNames.lhs-boot3
-rw-r--r--compiler/prelude/PrelRules.lhs9
-rw-r--r--compiler/prelude/TysWiredIn.lhs2
-rw-r--r--compiler/prelude/primops.txt.pp11
5 files changed, 49 insertions, 4 deletions
diff --git a/compiler/prelude/PrelNames.lhs b/compiler/prelude/PrelNames.lhs
index a67580a18c..19acf488e0 100644
--- a/compiler/prelude/PrelNames.lhs
+++ b/compiler/prelude/PrelNames.lhs
@@ -227,13 +227,19 @@ basicKnownKeyNames
-- Stable pointers
newStablePtrName,
- -- GHC Extensions
+ -- GHC Extensions
groupWithName,
-- Strings and lists
unpackCStringName,
unpackCStringFoldrName, unpackCStringUtf8Name,
-
+
+ -- Overloaded lists
+ isListClassName,
+ fromListName,
+ fromListNName,
+ toListName,
+
-- List operations
concatName, filterName, mapName,
zipName, foldrName, buildName, augmentName, appendName,
@@ -570,6 +576,11 @@ plus_RDR = varQual_RDR gHC_NUM (fsLit "+")
fromString_RDR :: RdrName
fromString_RDR = nameRdrName fromStringName
+fromList_RDR, fromListN_RDR, toList_RDR :: RdrName
+fromList_RDR = nameRdrName fromListName
+fromListN_RDR = nameRdrName fromListNName
+toList_RDR = nameRdrName toListName
+
compose_RDR :: RdrName
compose_RDR = varQual_RDR gHC_BASE (fsLit ".")
@@ -1002,6 +1013,13 @@ concatName = varQual gHC_LIST (fsLit "concat") concatIdKey
filterName = varQual gHC_LIST (fsLit "filter") filterIdKey
zipName = varQual gHC_LIST (fsLit "zip") zipIdKey
+-- Overloaded lists
+isListClassName, fromListName, fromListNName, toListName :: Name
+isListClassName = clsQual gHC_EXTS (fsLit "IsList") isListClassKey
+fromListName = methName gHC_EXTS (fsLit "fromList") fromListClassOpKey
+fromListNName = methName gHC_EXTS (fsLit "fromListN") fromListNClassOpKey
+toListName = methName gHC_EXTS (fsLit "toList") toListClassOpKey
+
-- Class Show
showClassName :: Name
showClassName = clsQual gHC_SHOW (fsLit "Show") showClassKey
@@ -1743,6 +1761,12 @@ mzipIdKey = mkPreludeMiscIdUnique 196
ghciStepIoMClassOpKey :: Unique
ghciStepIoMClassOpKey = mkPreludeMiscIdUnique 197
+-- Overloaded lists
+isListClassKey, fromListClassOpKey, fromListNClassOpKey, toListClassOpKey :: Unique
+isListClassKey = mkPreludeMiscIdUnique 198
+fromListClassOpKey = mkPreludeMiscIdUnique 199
+fromListNClassOpKey = mkPreludeMiscIdUnique 500
+toListClassOpKey = mkPreludeMiscIdUnique 501
---------------- Template Haskell -------------------
-- USES IdUniques 200-499
diff --git a/compiler/prelude/PrelNames.lhs-boot b/compiler/prelude/PrelNames.lhs-boot
index c14695b060..7b5365e621 100644
--- a/compiler/prelude/PrelNames.lhs-boot
+++ b/compiler/prelude/PrelNames.lhs-boot
@@ -1,9 +1,10 @@
-
\begin{code}
module PrelNames where
import Module
+import Unique
mAIN :: Module
+liftedTypeKindTyConKey :: Unique
\end{code}
diff --git a/compiler/prelude/PrelRules.lhs b/compiler/prelude/PrelRules.lhs
index 2e55e497d7..079ab0cc98 100644
--- a/compiler/prelude/PrelRules.lhs
+++ b/compiler/prelude/PrelRules.lhs
@@ -100,6 +100,15 @@ primOpRules nm IntRemOp = mkPrimOpRule nm 2 [ nonZeroLit 1 >> binaryLit (intO
retLit zeroi
, equalArgs >> retLit zeroi
, equalArgs >> retLit zeroi ]
+primOpRules nm AndIOp = mkPrimOpRule nm 2 [ binaryLit (intOp2 (.&.))
+ , idempotent
+ , zeroElem zeroi ]
+primOpRules nm OrIOp = mkPrimOpRule nm 2 [ binaryLit (intOp2 (.|.))
+ , idempotent
+ , identityDynFlags zeroi ]
+primOpRules nm XorIOp = mkPrimOpRule nm 2 [ binaryLit (intOp2 xor)
+ , identityDynFlags zeroi
+ , equalArgs >> retLit zeroi ]
primOpRules nm IntNegOp = mkPrimOpRule nm 1 [ unaryLit negOp
, inversePrimOp IntNegOp ]
primOpRules nm ISllOp = mkPrimOpRule nm 2 [ binaryLit (intOp2 Bits.shiftL)
diff --git a/compiler/prelude/TysWiredIn.lhs b/compiler/prelude/TysWiredIn.lhs
index e83fcb5255..8ee2d3f53e 100644
--- a/compiler/prelude/TysWiredIn.lhs
+++ b/compiler/prelude/TysWiredIn.lhs
@@ -48,7 +48,7 @@ module TysWiredIn (
wordTyCon, wordDataCon, wordTyConName, wordTy,
-- * List
- listTyCon, nilDataCon, consDataCon, consDataConName,
+ listTyCon, nilDataCon, nilDataConName, consDataCon, consDataConName,
listTyCon_RDR, consDataCon_RDR, listTyConName,
mkListTy, mkPromotedListTy,
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index a5b0fec908..45472816c0 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -217,6 +217,17 @@ primop IntQuotRemOp "quotRemInt#" GenPrimOp
{Rounds towards zero.}
with can_fail = True
+primop AndIOp "andI#" Dyadic Int# -> Int# -> Int#
+ with commutable = True
+
+primop OrIOp "orI#" Dyadic Int# -> Int# -> Int#
+ with commutable = True
+
+primop XorIOp "xorI#" Dyadic Int# -> Int# -> Int#
+ with commutable = True
+
+primop NotIOp "notI#" Monadic Int# -> Int#
+
primop IntNegOp "negateInt#" Monadic Int# -> Int#
primop IntAddCOp "addIntC#" GenPrimOp Int# -> Int# -> (# Int#, Int# #)
{Add with carry. First member of result is (wrapped) sum;