diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2013-09-13 18:40:36 +0200 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2013-09-13 21:58:26 +0200 |
commit | 17a868afa169c52d8525a95cbed87b2fc12044c6 (patch) | |
tree | a04530408077a286a80ca8d34c5d6dc0c98eddc6 /compiler/prelude/PrelNames.lhs | |
parent | 638da2fecaaaf743c4da7f8e2522f4afc0d8400c (diff) | |
download | haskell-17a868afa169c52d8525a95cbed87b2fc12044c6.tar.gz |
Introduce coerce :: Coercible a b -> a -> bcoercible
This is the result of the design at
http://ghc.haskell.org/trac/ghc/wiki/NewtypeWrappers
The goal is to be able to convert between, say [First Int] and [Last
Int] with zero run-time overhead. To that end, we introduce a special
two parameter type class Coercible whose instances are created
automatically and on-the fly. This relies on and exploits the recent
addition of roles to core.
Diffstat (limited to 'compiler/prelude/PrelNames.lhs')
-rw-r--r-- | compiler/prelude/PrelNames.lhs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/prelude/PrelNames.lhs b/compiler/prelude/PrelNames.lhs index acac400c04..dfb3f82b7b 100644 --- a/compiler/prelude/PrelNames.lhs +++ b/compiler/prelude/PrelNames.lhs @@ -352,7 +352,7 @@ genericTyConNames = [ pRELUDE :: Module pRELUDE = mkBaseModule_ pRELUDE_NAME -gHC_PRIM, gHC_PRIMWRAPPERS, gHC_TYPES, gHC_GENERICS, gHC_MAGIC, +gHC_PRIM, gHC_PRIMWRAPPERS, gHC_TYPES, gHC_GENERICS, gHC_MAGIC, gHC_COERCIBLE, gHC_CLASSES, gHC_BASE, gHC_ENUM, gHC_GHCI, gHC_CSTRING, gHC_SHOW, gHC_READ, gHC_NUM, gHC_INTEGER_TYPE, gHC_LIST, gHC_TUPLE, dATA_TUPLE, dATA_EITHER, dATA_STRING, dATA_FOLDABLE, dATA_TRAVERSABLE, dATA_MONOID, @@ -370,6 +370,7 @@ gHC_TYPES = mkPrimModule (fsLit "GHC.Types") gHC_MAGIC = mkPrimModule (fsLit "GHC.Magic") gHC_CSTRING = mkPrimModule (fsLit "GHC.CString") gHC_CLASSES = mkPrimModule (fsLit "GHC.Classes") +gHC_COERCIBLE = mkPrimModule (fsLit "GHC.Coercible") gHC_BASE = mkBaseModule (fsLit "GHC.Base") gHC_ENUM = mkBaseModule (fsLit "GHC.Enum") @@ -1486,6 +1487,11 @@ doubleX2PrimTyConKey = mkPreludeTyConUnique 171 int32X4PrimTyConKey = mkPreludeTyConUnique 172 int64X2PrimTyConKey = mkPreludeTyConUnique 173 +ntTyConKey:: Unique +ntTyConKey = mkPreludeTyConUnique 174 +coercibleTyConKey :: Unique +coercibleTyConKey = mkPreludeTyConUnique 175 + ---------------- Template Haskell ------------------- -- USES TyConUniques 200-299 ----------------------------------------------------- @@ -1504,7 +1510,7 @@ unitTyConKey = mkTupleTyConUnique BoxedTuple 0 charDataConKey, consDataConKey, doubleDataConKey, falseDataConKey, floatDataConKey, intDataConKey, nilDataConKey, ratioDataConKey, stableNameDataConKey, trueDataConKey, wordDataConKey, - ioDataConKey, integerDataConKey, eqBoxDataConKey :: Unique + ioDataConKey, integerDataConKey, eqBoxDataConKey, coercibleDataConKey :: Unique charDataConKey = mkPreludeDataConUnique 1 consDataConKey = mkPreludeDataConUnique 2 doubleDataConKey = mkPreludeDataConUnique 3 @@ -1544,6 +1550,8 @@ gtDataConKey = mkPreludeDataConUnique 29 integerGmpSDataConKey, integerGmpJDataConKey :: Unique integerGmpSDataConKey = mkPreludeDataConUnique 30 integerGmpJDataConKey = mkPreludeDataConUnique 31 + +coercibleDataConKey = mkPreludeDataConUnique 32 \end{code} %************************************************************************ @@ -1710,6 +1718,9 @@ undefinedKey = mkPreludeMiscIdUnique 155 magicSingIKey :: Unique magicSingIKey = mkPreludeMiscIdUnique 156 + +coerceKey :: Unique +coerceKey = mkPreludeMiscIdUnique 157 \end{code} Certain class operations from Prelude classes. They get their own |