[project @ 1997-06-09 07:41:09 by sof]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcKind.lhs
index 3026867..20b0ff1 100644 (file)
@@ -1,4 +1,6 @@
 \begin{code}
+#include "HsVersions.h"
+
 module TcKind (
 
        Kind, mkTypeKind, mkBoxedTypeKind, mkUnboxedTypeKind, mkArrowKind, 
@@ -14,12 +16,17 @@ module TcKind (
        tcDefaultKind   -- TcKind s -> NF_TcM s Kind
   ) where
 
+IMP_Ubiq(){-uitous-}
+
 import Kind
-import TcMonad hiding ( rnMtoTcM )
+import TcMonad
 
-import Ubiq
 import Unique  ( Unique, pprUnique10 )
 import Pretty
+import Util    ( nOfThem )
+#if __GLASGOW_HASKELL__ >= 202
+import Outputable
+#endif
 \end{code}
 
 
@@ -39,7 +46,7 @@ newKindVar = tcGetUnique              `thenNF_Tc` \ uniq ->
             returnNF_Tc (TcVarKind uniq box)
 
 newKindVars :: Int -> NF_TcM s [TcKind s]
-newKindVars n = mapNF_Tc (\_->newKindVar) (take n (repeat ()))
+newKindVars n = mapNF_Tc (\ _ -> newKindVar) (nOfThem n ())
 \end{code}
 
 
@@ -175,13 +182,13 @@ instance Outputable (TcKind s) where
   ppr sty kind = ppr_kind sty kind
 
 ppr_kind sty TcTypeKind 
-  = ppStr "*"
+  = char '*'
 ppr_kind sty (TcArrowKind kind1 kind2) 
-  = ppSep [ppr_parend sty kind1, ppStr "->", ppr_kind sty kind2]
+  = sep [ppr_parend sty kind1, ptext SLIT("->"), ppr_kind sty kind2]
 ppr_kind sty (TcVarKind uniq box) 
-  = ppBesides [ppStr "k", pprUnique10 uniq]
+  = hcat [char 'k', pprUnique10 uniq]
 
-ppr_parend sty kind@(TcArrowKind _ _) = ppBesides [ppChar '(', ppr_kind sty kind, ppChar ')']
+ppr_parend sty kind@(TcArrowKind _ _) = hcat [char '(', ppr_kind sty kind, char ')']
 ppr_parend sty other_kind            = ppr_kind sty other_kind
 \end{code}
 
@@ -191,20 +198,17 @@ Errors and contexts
 ~~~~~~~~~~~~~~~~~~~
 \begin{code}
 unifyKindCtxt kind1 kind2 sty
-  = ppHang (ppStr "When unifying two kinds") 4
-          (ppSep [ppr sty kind1, ppStr "and", ppr sty kind2])
+  = hang (ptext SLIT("When unifying two kinds")) 4
+          (sep [ppr sty kind1, ptext SLIT("and"), ppr sty kind2])
 
 kindOccurCheck kind1 kind2 sty
-  = ppHang (ppStr "Cannot construct the infinite kind:") 4
-       (ppSep [ppBesides [ppStr "`", ppr sty kind1, ppStr "'"],
-               ppStr "=",
-               ppBesides [ppStr "`", ppr sty kind1, ppStr "'"],
-               ppStr "(\"occurs check\")"])
+  = hang (ptext SLIT("Cannot construct the infinite kind:")) 4
+       (sep [ppr sty kind1, equals, ppr sty kind1, ptext SLIT("(\"occurs check\")")])
 
 kindMisMatchErr kind1 kind2 sty
- = ppHang (ppStr "Couldn't match the kind") 4
-       (ppSep [ppBesides [ppStr "`", ppr sty kind1, ppStr "'"],
-               ppStr "against",
-               ppBesides [ppStr "`", ppr sty kind2, ppStr "'"]
-       ])
+ = hang (ptext SLIT("Couldn't match the kind")) 4
+       (sep [ppr sty kind1,
+             ptext SLIT("against"),
+             ppr sty kind2]
+       )
 \end{code}