Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gesh
GHC
Commits
df5a4155
Commit
df5a4155
authored
27 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-05-18 22:26:40 by sof]
New PP
parent
1bdff315
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ghc/compiler/typecheck/TcInstUtil.lhs
+17
-11
17 additions, 11 deletions
ghc/compiler/typecheck/TcInstUtil.lhs
ghc/compiler/typecheck/TcKind.lhs
+16
-16
16 additions, 16 deletions
ghc/compiler/typecheck/TcKind.lhs
ghc/compiler/typecheck/TcMatches.lhs
+10
-5
10 additions, 5 deletions
ghc/compiler/typecheck/TcMatches.lhs
with
43 additions
and
32 deletions
ghc/compiler/typecheck/TcInstUtil.lhs
+
17
−
11
View file @
df5a4155
...
...
@@ -24,13 +24,13 @@ import TcEnv ( tcAddImportedIdInfo )
import TcMonad
import Inst ( SYN_IE(InstanceMapper) )
import Bag ( bagToList )
import Bag ( bagToList
, Bag
)
import Class ( GenClass, GenClassOp, SYN_IE(ClassInstEnv),
classBigSig, classOps, classOpLocalType,
SYN_IE(ClassOp)
SYN_IE(ClassOp)
, SYN_IE(Class)
)
import CoreSyn ( GenCoreExpr(..), mkValLam, mkTyApp )
import Id ( GenId, mkDictFunId, mkConstMethodId, mkSysLocal )
import Id ( GenId, mkDictFunId, mkConstMethodId, mkSysLocal
, SYN_IE(Id)
)
import MatchEnv ( nullMEnv, insertMEnv )
import Maybes ( MaybeErr(..), mkLookupFunDef )
import Name ( getSrcLoc, Name{--O only-} )
...
...
@@ -39,10 +39,16 @@ import Pretty
import SpecEnv ( SpecEnv, nullSpecEnv, addOneToSpecEnv )
import SrcLoc ( SrcLoc )
import Type ( mkSigmaTy, mkForAllTys, mkDictTy, mkTyVarTys,
splitForAllTy, instantiateTy, matchTy, SYN_IE(ThetaType) )
import TyVar ( GenTyVar )
instantiateTy, matchTy, SYN_IE(ThetaType),
SYN_IE(Type) )
import TyVar ( GenTyVar, SYN_IE(TyVar) )
import Unique ( Unique )
import Util ( equivClasses, zipWithEqual, panic{-, pprTrace-} )
import Util ( equivClasses, zipWithEqual, panic{-, pprTrace-}, Ord3(..) )
#if __GLASGOW_HASKELL__ >= 202
import Outputable
#endif
--import PprStyle
--import TcPragmas ( tcDictFunPragmas, tcGenPragmas )
...
...
@@ -229,10 +235,10 @@ addClassInstance
dupInstFailure clas info1@(ty1, locn1) info2@(ty2, locn2)
-- Overlapping/duplicate instances for given class; msg could be more glamourous
= tcAddErrCtxt ctxt $
failTc (\sty -> p
pPStr
SLIT("Duplicate or overlapping instance declarations"))
failTc (\sty -> p
text
SLIT("Duplicate or overlapping instance declarations"))
where
ctxt sty =
ppH
ang (
ppS
ep [p
pBesides[ppPStr
SLIT("Class
`
"), ppr sty clas,
ppChar '\''],
ppBesides[ppPStr
SLIT("type
`
"), ppr sty ty1
, ppChar '\'']
])
4 (
ppS
ep [
ppBesides [ppPStr
SLIT("at "), ppr sty locn1],
ppBesides [ppPStr
SLIT("and "), ppr sty locn2]])
ctxt sty =
h
ang (
s
ep [p
text
SLIT("Class"), ppr sty clas,
ptext
SLIT("type"),
ppr sty ty1])
4 (
s
ep [
hcat [ptext
SLIT("at "), ppr sty locn1],
hcat [ptext
SLIT("and "), ppr sty locn2]])
\end{code}
This diff is collapsed.
Click to expand it.
ghc/compiler/typecheck/TcKind.lhs
+
16
−
16
View file @
df5a4155
...
...
@@ -24,6 +24,9 @@ import TcMonad
import Unique ( Unique, pprUnique10 )
import Pretty
import Util ( nOfThem )
#if __GLASGOW_HASKELL__ >= 202
import Outputable
#endif
\end{code}
...
...
@@ -179,13 +182,13 @@ instance Outputable (TcKind s) where
ppr sty kind = ppr_kind sty kind
ppr_kind sty TcTypeKind
=
ppC
har '*'
=
c
har '*'
ppr_kind sty (TcArrowKind kind1 kind2)
=
ppS
ep [ppr_parend sty kind1, p
pPStr
SLIT("->"), ppr_kind sty kind2]
=
s
ep [ppr_parend sty kind1, p
text
SLIT("->"), ppr_kind sty kind2]
ppr_kind sty (TcVarKind uniq box)
=
ppBesides [ppC
har 'k', pprUnique10 uniq]
=
hcat [c
har 'k', pprUnique10 uniq]
ppr_parend sty kind@(TcArrowKind _ _) =
ppBesides [ppC
har '(', ppr_kind sty kind,
ppC
har ')']
ppr_parend sty kind@(TcArrowKind _ _) =
hcat [c
har '(', ppr_kind sty kind,
c
har ')']
ppr_parend sty other_kind = ppr_kind sty other_kind
\end{code}
...
...
@@ -195,20 +198,17 @@ Errors and contexts
~~~~~~~~~~~~~~~~~~~
\begin{code}
unifyKindCtxt kind1 kind2 sty
=
ppH
ang (p
pPStr
SLIT("When unifying two kinds")) 4
(
ppS
ep [ppr sty kind1, p
pPStr
SLIT("and"), ppr sty kind2])
=
h
ang (p
text
SLIT("When unifying two kinds")) 4
(
s
ep [ppr sty kind1, p
text
SLIT("and"), ppr sty kind2])
kindOccurCheck kind1 kind2 sty
= ppHang (ppPStr SLIT("Cannot construct the infinite kind:")) 4
(ppSep [ppBesides [ppChar '`', ppr sty kind1, ppChar '\''],
ppChar '=',
ppBesides [ppChar '`', ppr sty kind1, ppChar '\''],
ppPStr SLIT("(\"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
=
ppH
ang (p
pPStr
SLIT("Couldn't match the kind")) 4
(
ppS
ep [pp
Besides [ppChar '`', ppr sty kind1, ppChar '\'']
,
ppPStr
SLIT("against"),
ppBesides [ppChar '`',
ppr sty kind2
, ppChar '\''
]
]
)
=
h
ang (p
text
SLIT("Couldn't match the kind")) 4
(
s
ep [pp
r sty kind1
,
ptext
SLIT("against"),
ppr sty kind2]
)
\end{code}
This diff is collapsed.
Click to expand it.
ghc/compiler/typecheck/TcMatches.lhs
+
10
−
5
View file @
df5a4155
...
...
@@ -11,7 +11,7 @@ module TcMatches ( tcMatchesFun, tcMatchesCase, tcMatch ) where
IMP_Ubiq()
import HsSyn ( Match(..), GRHSsAndBinds(..), GRHS(..), InPat,
HsExpr, HsBinds, OutPat, Fake,
HsExpr, HsBinds, OutPat, Fake,
Stmt,
collectPatBinders, pprMatch )
import RnHsSyn ( SYN_IE(RenamedMatch) )
import TcHsSyn ( TcIdOcc(..), SYN_IE(TcMatch) )
...
...
@@ -29,6 +29,11 @@ import Kind ( Kind, mkTypeKind )
import Pretty
import Type ( isTyVarTy, mkFunTy, getFunTy_maybe )
import Util
import Outputable
#if __GLASGOW_HASKELL__ >= 202
import SrcLoc (SrcLoc)
#endif
\end{code}
@tcMatchesFun@ typechecks a @[Match]@ list which occurs in a
...
...
@@ -208,16 +213,16 @@ Errors and contexts
~~~~~~~~~~~~~~~~~~~
\begin{code}
matchCtxt MCase match sty
=
ppH
ang (p
pPStr
SLIT("In a \"case\" branch:"))
=
h
ang (p
text
SLIT("In a \"case\" branch:"))
4 (pprMatch sty True{-is_case-} match)
matchCtxt (MFun fun) match sty
=
ppH
ang (
ppBesides [ppPStr
SLIT("In an equation for function "), ppr sty fun,
ppC
har ':'])
4 (pp
Besides
[ppr sty fun,
ppSP
, pprMatch sty False{-not case-} match])
=
h
ang (
hcat [ptext
SLIT("In an equation for function "), ppr sty fun,
c
har ':'])
4 (pp
rQuote sty $ \sty -> hcat
[ppr sty fun,
space
, pprMatch sty False{-not case-} match])
\end{code}
\begin{code}
varyingArgsErr name matches sty
=
ppS
ep [p
pPStr
SLIT("Varying number of arguments for function"), ppr sty name]
=
s
ep [p
text
SLIT("Varying number of arguments for function"), ppr sty name]
\end{code}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment