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
4650a817
Commit
4650a817
authored
27 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1998-02-28 12:14:33 by sof]
Generate a little bit less code for record selectors.
parent
ff8f8a74
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/compiler/prelude/StdIdInfo.lhs
+12
-4
12 additions, 4 deletions
ghc/compiler/prelude/StdIdInfo.lhs
with
12 additions
and
4 deletions
ghc/compiler/prelude/StdIdInfo.lhs
+
12
−
4
View file @
4650a817
...
...
@@ -39,6 +39,7 @@ import TyCon ( isNewTyCon, tyConDataCons, isDataTyCon )
import FieldLabel ( FieldLabel )
import PrelVals ( pAT_ERROR_ID )
import Maybes
import Maybe ( isJust )
import Outputable
import Util ( assoc )
\end{code}
...
...
@@ -153,10 +154,17 @@ addStandardIdInfo sel_id
tyvar_tys = mkTyVarTys tyvars
[data_id] = mkTemplateLocals [data_ty]
sel_rhs = mkTyLam tyvars $
mkValLam [data_id] $
Case (Var data_id) (AlgAlts (catMaybes (map mk_maybe_alt data_cons))
(BindDefault data_id error_expr))
alts = map mk_maybe_alt data_cons
sel_rhs = mkTyLam tyvars $
mkValLam [data_id] $
Case (Var data_id)
-- if any of the constructors don't have the label, ...
(if any (not . isJust) alts then
AlgAlts (catMaybes alts)
(BindDefault data_id error_expr)
else
AlgAlts (catMaybes alts) NoDefault)
mk_maybe_alt data_con
= case maybe_the_arg_id of
Nothing -> Nothing
...
...
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