Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
89e484f7
Commit
89e484f7
authored
Sep 15, 2010
by
simonpj@microsoft.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve pretty-printing of family instances
Fixed Trac #4246
parent
07c01d09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
compiler/types/FamInstEnv.lhs
compiler/types/FamInstEnv.lhs
+16
-8
No files found.
compiler/types/FamInstEnv.lhs
View file @
89e484f7
...
...
@@ -88,15 +88,23 @@ pprFamInst famInst
2 (ptext (sLit "--") <+> pprNameLoc (getName famInst))
pprFamInstHdr :: FamInst -> SDoc
pprFamInstHdr (FamInst {fi_
fam = fam, fi_tys = tys, fi_tycon = tycon
})
= pprTyConSort <+> pprHead
pprFamInstHdr (FamInst {fi_
tycon = rep_tc
})
= pprTyConSort <+> pp
_instance <+> pp
rHead
where
pprHead = pprTypeApp fam tys
pprTyConSort | isDataTyCon tycon = ptext (sLit "data instance")
| isNewTyCon tycon = ptext (sLit "newtype instance")
| isSynTyCon tycon = ptext (sLit "type instance")
| isAbstractTyCon tycon = ptext (sLit "data instance")
| otherwise = panic "FamInstEnv.pprFamInstHdr"
Just (fam_tc, tys) = tyConFamInst_maybe rep_tc
-- For *associated* types, say "type T Int = blah"
-- For *top level* type instances, say "type instance T Int = blah"
pp_instance
| isTyConAssoc fam_tc = empty
| otherwise = ptext (sLit "instance")
pprHead = pprTypeApp fam_tc tys
pprTyConSort | isDataTyCon rep_tc = ptext (sLit "data")
| isNewTyCon rep_tc = ptext (sLit "newtype")
| isSynTyCon rep_tc = ptext (sLit "type")
| isAbstractTyCon rep_tc = ptext (sLit "data")
| otherwise = panic "FamInstEnv.pprFamInstHdr"
pprFamInsts :: [FamInst] -> SDoc
pprFamInsts finsts = vcat (map pprFamInst finsts)
...
...
Write
Preview
Markdown
is supported
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