add support for <{..}> and ~~> syntax as well as typing for Kappa-calculus
[ghc-hetmet.git] / compiler / prelude / TysWiredIn.lhs
index bc45028..e420d7b 100644 (file)
@@ -50,9 +50,16 @@ module TysWiredIn (
         -- * Heterogeneous Metaprogramming
        mkHetMetCodeTypeTy,
         hetMetCodeTypeTyConName,
-       hetMetCodeTypeTyCon,     isHetMetCodeTypeTyCon,
+       hetMetCodeTypeTyCon,
+        isHetMetCodeTypeTyCon,
        hetMetCodeTypeTyCon_RDR,
 
+       mkHetMetKappaTy,
+        hetMetKappaTyConName,
+       hetMetKappaTyCon,
+       hetMetKappaTyCon_RDR,
+        isHetMetKappaTyCon,
+
         -- * Parallel arrays
        mkPArrTy,
        parrTyCon, parrFakeCon, isPArrTyCon, isPArrFakeCon,
@@ -122,6 +129,7 @@ wiredInTyCons = [ unitTyCon -- Not treated like other tuples, because
              , listTyCon
              , parrTyCon
              , hetMetCodeTypeTyCon
+             , hetMetKappaTyCon
              ]
 \end{code}
 
@@ -172,8 +180,12 @@ hetMetCodeTypeDataConName :: Name
 hetMetCodeTypeDataConName      =
     mkWiredInDataConName  BuiltInSyntax gHC_HETMET_CODETYPES (fsLit "<[]>")      hetMetCodeTypeDataConKey hetMetCodeTypeDataCon
 
+hetMetKappaTyConName :: Name
+hetMetKappaTyConName = mkWiredInTyConName   BuiltInSyntax gHC_HETMET_CODETYPES (fsLit "~~>")  hetMetKappaTyConKey hetMetKappaTyCon
+
 boolTyCon_RDR, false_RDR, true_RDR, intTyCon_RDR, charTyCon_RDR,
-    intDataCon_RDR, listTyCon_RDR, consDataCon_RDR, parrTyCon_RDR, hetMetCodeTypeTyCon_RDR :: RdrName
+    intDataCon_RDR, listTyCon_RDR, consDataCon_RDR, parrTyCon_RDR, hetMetCodeTypeTyCon_RDR,
+    hetMetKappaTyCon_RDR :: RdrName
 boolTyCon_RDR   = nameRdrName boolTyConName
 false_RDR      = nameRdrName falseDataConName
 true_RDR       = nameRdrName trueDataConName
@@ -184,6 +196,7 @@ listTyCon_RDR       = nameRdrName listTyConName
 consDataCon_RDR = nameRdrName consDataConName
 parrTyCon_RDR  = nameRdrName parrTyConName
 hetMetCodeTypeTyCon_RDR        = nameRdrName hetMetCodeTypeTyConName
+hetMetKappaTyCon_RDR = nameRdrName hetMetKappaTyConName
 \end{code}
 
 
@@ -614,16 +627,25 @@ Heterogeneous Metaprogramming
 mkHetMetCodeTypeTy    :: TyVar -> Type -> Type
 mkHetMetCodeTypeTy ecn ty = mkTyConApp hetMetCodeTypeTyCon [(mkTyVarTy ecn), ty]
 
+mkHetMetKappaTy    :: Type -> Type -> Type
+mkHetMetKappaTy a b = mkTyConApp hetMetKappaTyCon [a, b]
+
 ecTyVar = head ecTyVars
 
 -- | Represents the type constructor of box types
 hetMetCodeTypeTyCon :: TyCon
 hetMetCodeTypeTyCon  = pcNonRecDataTyCon hetMetCodeTypeTyConName [ecTyVar, betaTyVar] [hetMetCodeTypeDataCon]
 
+hetMetKappaTyCon :: TyCon
+hetMetKappaTyCon  = pcNonRecDataTyCon hetMetKappaTyConName [alphaTyVar, betaTyVar] []
+
 -- | Check whether a type constructor is the constructor for box types
 isHetMetCodeTypeTyCon    :: TyCon -> Bool
 isHetMetCodeTypeTyCon tc  = tyConName tc == hetMetCodeTypeTyConName
 
+isHetMetKappaTyCon    :: TyCon -> Bool
+isHetMetKappaTyCon tc  = tyConName tc == hetMetKappaTyConName
+
 hetMetCodeTypeDataCon :: DataCon
 hetMetCodeTypeDataCon  = pcDataCon 
                 hetMetCodeTypeDataConName