Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
curry
curry-frontend
Commits
954a0bfc
Commit
954a0bfc
authored
Aug 08, 2014
by
Jan Rasmus Tikovsky
Browse files
Moved pretty-printing of types from Checks.TypeCheck to Base.CurryTypes
parent
2b3d21df
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Base/CurryTypes.hs
View file @
954a0bfc
...
...
@@ -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
src/Checks/TypeCheck.hs
View file @
954a0bfc
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment