diff options
author | Ian Lynagh <igloo@earth.li> | 2012-02-16 15:45:03 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-02-16 15:45:03 +0000 |
commit | d2377e86a97c68f43f04217ea8e3558571be6238 (patch) | |
tree | c2b080d97997e6e31c146208ac2b18ee4285b190 /compiler | |
parent | 546dd4f219ba05880e252e7fee6a2037a50ed3b3 (diff) | |
download | haskell-d2377e86a97c68f43f04217ea8e3558571be6238.tar.gz |
Add CType informatino to wired-in types
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/prelude/TysWiredIn.lhs | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/compiler/prelude/TysWiredIn.lhs b/compiler/prelude/TysWiredIn.lhs index dee8bcde24..d7cfc58765 100644 --- a/compiler/prelude/TysWiredIn.lhs +++ b/compiler/prelude/TysWiredIn.lhs @@ -96,6 +96,7 @@ import RdrName import Name import BasicTypes ( TupleSort(..), tupleSortBoxity, IPName(..), Arity, RecFlag(..), Boxity(..), HsBang(..) ) +import ForeignCall import Unique ( incrUnique, mkTupleTyConUnique, mkTupleDataConUnique, mkPArrDataConUnique ) import Data.Array @@ -229,19 +230,19 @@ eqTyCon_RDR = nameRdrName eqTyConName %************************************************************************ \begin{code} -pcNonRecDataTyCon :: Name -> [TyVar] -> [DataCon] -> TyCon +pcNonRecDataTyCon :: Name -> Maybe CType -> [TyVar] -> [DataCon] -> TyCon pcNonRecDataTyCon = pcTyCon False NonRecursive -pcRecDataTyCon :: Name -> [TyVar] -> [DataCon] -> TyCon +pcRecDataTyCon :: Name -> Maybe CType -> [TyVar] -> [DataCon] -> TyCon pcRecDataTyCon = pcTyCon False Recursive -pcTyCon :: Bool -> RecFlag -> Name -> [TyVar] -> [DataCon] -> TyCon -pcTyCon is_enum is_rec name tyvars cons +pcTyCon :: Bool -> RecFlag -> Name -> Maybe CType -> [TyVar] -> [DataCon] -> TyCon +pcTyCon is_enum is_rec name cType tyvars cons = tycon where tycon = mkAlgTyCon name (mkArrowKinds (map tyVarKind tyvars) liftedTypeKind) tyvars - Nothing + cType [] -- No stupid theta (DataTyCon cons is_enum) NoParentTyCon @@ -459,7 +460,8 @@ charTy :: Type charTy = mkTyConTy charTyCon charTyCon :: TyCon -charTyCon = pcNonRecDataTyCon charTyConName [] [charDataCon] +charTyCon = pcNonRecDataTyCon charTyConName (Just (CType (fsLit "HsChar"))) + [] [charDataCon] charDataCon :: DataCon charDataCon = pcDataCon charDataConName [] [charPrimTy] charTyCon @@ -471,7 +473,7 @@ stringTy = mkListTy charTy -- convenience only integerTyCon :: TyCon integerTyCon = case cIntegerLibraryType of IntegerGMP -> - pcNonRecDataTyCon integerRealTyConName [] + pcNonRecDataTyCon integerRealTyConName Nothing [] [integerGmpSDataCon, integerGmpJDataCon] _ -> panic "Evaluated integerTyCon, but not using IntegerGMP" @@ -494,7 +496,7 @@ intTy :: Type intTy = mkTyConTy intTyCon intTyCon :: TyCon -intTyCon = pcNonRecDataTyCon intTyConName [] [intDataCon] +intTyCon = pcNonRecDataTyCon intTyConName (Just (CType (fsLit "HsInt"))) [] [intDataCon] intDataCon :: DataCon intDataCon = pcDataCon intDataConName [] [intPrimTy] intTyCon \end{code} @@ -504,7 +506,7 @@ wordTy :: Type wordTy = mkTyConTy wordTyCon wordTyCon :: TyCon -wordTyCon = pcNonRecDataTyCon wordTyConName [] [wordDataCon] +wordTyCon = pcNonRecDataTyCon wordTyConName (Just (CType (fsLit "HsWord"))) [] [wordDataCon] wordDataCon :: DataCon wordDataCon = pcDataCon wordDataConName [] [wordPrimTy] wordTyCon \end{code} @@ -514,7 +516,7 @@ floatTy :: Type floatTy = mkTyConTy floatTyCon floatTyCon :: TyCon -floatTyCon = pcNonRecDataTyCon floatTyConName [] [floatDataCon] +floatTyCon = pcNonRecDataTyCon floatTyConName (Just (CType (fsLit "HsFloat"))) [] [floatDataCon] floatDataCon :: DataCon floatDataCon = pcDataCon floatDataConName [] [floatPrimTy] floatTyCon \end{code} @@ -524,7 +526,7 @@ doubleTy :: Type doubleTy = mkTyConTy doubleTyCon doubleTyCon :: TyCon -doubleTyCon = pcNonRecDataTyCon doubleTyConName [] [doubleDataCon] +doubleTyCon = pcNonRecDataTyCon doubleTyConName (Just (CType (fsLit "HsDouble"))) [] [doubleDataCon] doubleDataCon :: DataCon doubleDataCon = pcDataCon doubleDataConName [] [doublePrimTy] doubleTyCon @@ -585,7 +587,8 @@ boolTy = mkTyConTy boolTyCon boolTyCon :: TyCon boolTyCon = pcTyCon True NonRecursive boolTyConName - [] [falseDataCon, trueDataCon] + (Just (CType (fsLit "HsBool"))) + [] [falseDataCon, trueDataCon] falseDataCon, trueDataCon :: DataCon falseDataCon = pcDataCon falseDataConName [] [] boolTyCon @@ -596,7 +599,7 @@ falseDataConId = dataConWorkId falseDataCon trueDataConId = dataConWorkId trueDataCon orderingTyCon :: TyCon -orderingTyCon = pcTyCon True NonRecursive orderingTyConName +orderingTyCon = pcTyCon True NonRecursive orderingTyConName Nothing [] [ltDataCon, eqDataCon, gtDataCon] ltDataCon, eqDataCon, gtDataCon :: DataCon @@ -630,7 +633,7 @@ mkListTy :: Type -> Type mkListTy ty = mkTyConApp listTyCon [ty] listTyCon :: TyCon -listTyCon = pcRecDataTyCon listTyConName alpha_tyvar [nilDataCon, consDataCon] +listTyCon = pcRecDataTyCon listTyConName Nothing alpha_tyvar [nilDataCon, consDataCon] mkPromotedListTy :: Type -> Type mkPromotedListTy ty = mkTyConApp promotedListTyCon [ty] @@ -732,7 +735,7 @@ mkPArrTy ty = mkTyConApp parrTyCon [ty] -- @PrelPArr@. -- parrTyCon :: TyCon -parrTyCon = pcNonRecDataTyCon parrTyConName alpha_tyvar [parrDataCon] +parrTyCon = pcNonRecDataTyCon parrTyConName Nothing alpha_tyvar [parrDataCon] parrDataCon :: DataCon parrDataCon = pcDataCon |