Commit 954a0bfc authored by Jan Rasmus Tikovsky 's avatar Jan Rasmus Tikovsky

Moved pretty-printing of types from Checks.TypeCheck to Base.CurryTypes

parent 2b3d21df
......@@ -22,14 +22,17 @@
-}
module Base.CurryTypes
( toQualType, toQualTypes, toType, toTypes, fromQualType, fromType
( toQualType, toQualTypes, toType, toTypes, fromQualType, fromType,
ppType, ppTypeScheme
) where
import Data.List (nub)
import qualified Data.Map as Map (Map, fromList, lookup)
import Curry.Base.Ident
import Curry.Base.Pretty (Doc)
import qualified Curry.Syntax as CS
import Curry.Syntax.Pretty (ppTypeExpr)
import Base.Expr
import Base.Messages (internalError)
......@@ -95,3 +98,10 @@ fromType (TypeSkolem k) =
fromType (TypeRecord fs rty) = CS.RecordType
(map (\ (l, ty) -> ([l], fromType ty)) fs)
((fromType . TypeVariable) `fmap` rty)
-- The following functions implement pretty-printing for types.
ppType :: ModuleIdent -> Type -> Doc
ppType m = ppTypeExpr 0 . fromQualType m
ppTypeScheme :: ModuleIdent -> TypeScheme -> Doc
ppTypeScheme m (ForAll _ ty) = ppType m ty
\ No newline at end of file
......@@ -37,7 +37,7 @@ import Curry.Base.Pretty
import Curry.Syntax
import Curry.Syntax.Pretty
import Base.CurryTypes (fromQualType, toType, toTypes)
import Base.CurryTypes (toType, toTypes, ppType, ppTypeScheme)
import Base.Expr
import Base.Messages (Message, posMessage, internalError)
import Base.SCC
......@@ -1354,9 +1354,4 @@ errIncompatibleLabelTypes m l ty1 ty2 = sep
, text "are incompatible"
]
-- The following functions implement pretty-printing for types.
ppType :: ModuleIdent -> Type -> Doc
ppType m = ppTypeExpr 0 . fromQualType m
ppTypeScheme :: ModuleIdent -> TypeScheme -> Doc
ppTypeScheme m (ForAll _ ty) = ppType m ty
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment