[commit: ghc] wip/T9281: [WIP] fixup wired-in BigNat (9c370fe)

git at git.haskell.org git at git.haskell.org
Sun Aug 17 11:45:30 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T9281
Link       : http://ghc.haskell.org/trac/ghc/changeset/9c370fe127a38c8e9bbbd9e3ba7ae066c6a9cdf8/ghc

>---------------------------------------------------------------

commit 9c370fe127a38c8e9bbbd9e3ba7ae066c6a9cdf8
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Aug 16 23:18:17 2014 +0200

    [WIP] fixup wired-in BigNat


>---------------------------------------------------------------

9c370fe127a38c8e9bbbd9e3ba7ae066c6a9cdf8
 compiler/prelude/PrelNames.lhs  |  9 +++++----
 compiler/prelude/TysWiredIn.lhs | 20 +++++++++++++++++---
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/compiler/prelude/PrelNames.lhs b/compiler/prelude/PrelNames.lhs
index 6a30a3f..ddf1c39 100644
--- a/compiler/prelude/PrelNames.lhs
+++ b/compiler/prelude/PrelNames.lhs
@@ -1328,7 +1328,7 @@ addrPrimTyConKey, arrayPrimTyConKey, arrayArrayPrimTyConKey, boolTyConKey, byteA
     floatPrimTyConKey, floatTyConKey, funTyConKey, intPrimTyConKey,
     intTyConKey, int8TyConKey, int16TyConKey, int32PrimTyConKey,
     int32TyConKey, int64PrimTyConKey, int64TyConKey,
-    integerTyConKey,
+    integerTyConKey, bigNatTyConKey,
     listTyConKey, foreignObjPrimTyConKey, weakPrimTyConKey,
     mutableArrayPrimTyConKey, mutableArrayArrayPrimTyConKey, mutableByteArrayPrimTyConKey,
     orderingTyConKey, mVarPrimTyConKey, ratioTyConKey, rationalTyConKey,
@@ -1355,7 +1355,7 @@ int32TyConKey                           = mkPreludeTyConUnique 19
 int64PrimTyConKey                       = mkPreludeTyConUnique 20
 int64TyConKey                           = mkPreludeTyConUnique 21
 integerTyConKey                         = mkPreludeTyConUnique 22
-
+bigNatTyConKey                          = mkPreludeTyConUnique 23
 listTyConKey                            = mkPreludeTyConUnique 24
 foreignObjPrimTyConKey                  = mkPreludeTyConUnique 25
 weakPrimTyConKey                        = mkPreludeTyConUnique 27
@@ -1594,12 +1594,13 @@ integerGmpJDataConKey                   = mkPreludeDataConUnique 31
 
 -- For integer-gmp2 only
 integerGmp2SIDataConKey, integerGmp2JpDataConKey,
-    integerGmp2JnDataConKey :: Unique
+    integerGmp2JnDataConKey, bigNatDataConKey :: Unique
 integerGmp2SIDataConKey                 = mkPreludeDataConUnique 32
 integerGmp2JpDataConKey                 = mkPreludeDataConUnique 33
 integerGmp2JnDataConKey                 = mkPreludeDataConUnique 34
+bigNatDataConKey                        = mkPreludeDataConUnique 35
 
-coercibleDataConKey                     = mkPreludeDataConUnique 35
+coercibleDataConKey                     = mkPreludeDataConUnique 36
 \end{code}
 
 %************************************************************************
diff --git a/compiler/prelude/TysWiredIn.lhs b/compiler/prelude/TysWiredIn.lhs
index d09c9dc..49c671b 100644
--- a/compiler/prelude/TysWiredIn.lhs
+++ b/compiler/prelude/TysWiredIn.lhs
@@ -165,7 +165,7 @@ wiredInTyCons = [ unitTyCon     -- Not treated like other tuples, because
               ]
            ++ (case cIntegerLibraryType of
                IntegerGMP -> [integerTyCon]
-               IntegerGMP2 -> [integerTyCon]
+               IntegerGMP2 -> [integerTyCon, bigNatTyCon]
                _ -> [])
 \end{code}
 
@@ -237,6 +237,11 @@ integerGmp2SIDataConName = mkWiredInDataConName UserSyntax gHC_INTEGER_TYPE (fsL
 integerGmp2JpDataConName = mkWiredInDataConName UserSyntax gHC_INTEGER_TYPE (fsLit "Jp#") integerGmp2JpDataConKey integerGmp2JpDataCon
 integerGmp2JnDataConName = mkWiredInDataConName UserSyntax gHC_INTEGER_TYPE (fsLit "Jn#") integerGmp2JnDataConKey integerGmp2JnDataCon
 
+-- GHC.Integer.Type.BigNat
+bigNatTyConName, bigNatDataConName :: Name
+bigNatTyConName   = mkWiredInTyConName   UserSyntax gHC_INTEGER_TYPE (fsLit "BigNat") bigNatTyConKey bigNatTyCon
+bigNatDataConName = mkWiredInDataConName UserSyntax gHC_INTEGER_TYPE (fsLit "BN#")  bigNatDataConKey bigNatDataCon
+
 parrTyConName, parrDataConName :: Name
 parrTyConName   = mkWiredInTyConName   BuiltInSyntax
                     gHC_PARR' (fsLit "[::]") parrTyConKey parrTyCon
@@ -614,14 +619,23 @@ integerGmpJDataCon = pcDataCon integerGmpJDataConName []
 
 integerGmp2JpDataCon :: DataCon
 integerGmp2JpDataCon = pcDataCon integerGmp2JpDataConName []
-                                 [byteArrayPrimTy]
+                                 [bigNatTy]
                                  integerTyCon
 
 integerGmp2JnDataCon :: DataCon
 integerGmp2JnDataCon = pcDataCon integerGmp2JnDataConName []
-                                 [byteArrayPrimTy]
+                                 [bigNatTy]
                                  integerTyCon
 
+bigNatTy :: Type
+bigNatTy = mkTyConTy bigNatTyCon
+
+bigNatTyCon :: TyCon
+bigNatTyCon = pcNonRecDataTyCon bigNatTyConName Nothing [] [bigNatDataCon]
+
+bigNatDataCon :: DataCon
+bigNatDataCon = pcDataCon bigNatDataConName [] [byteArrayPrimTy] bigNatTyCon
+
 \end{code}
 
 \begin{code}



More information about the ghc-commits mailing list