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
Environments
Terraform modules
Monitor
Incidents
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
Alexander Kaznacheev
GHC
Commits
d87990fe
Commit
d87990fe
authored
13 years ago
by
Simon Peyton Jones
Committed by
Ian Lynagh
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use nested tuples to desugar recursive do-notation
Easy fix for Trac #5742.
parent
e3b7e335
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
compiler/deSugar/DsExpr.lhs
+4
-4
4 additions, 4 deletions
compiler/deSugar/DsExpr.lhs
compiler/typecheck/TcMatches.lhs
+1
-1
1 addition, 1 deletion
compiler/typecheck/TcMatches.lhs
with
5 additions
and
5 deletions
compiler/deSugar/DsExpr.lhs
+
4
−
4
View file @
d87990fe
...
@@ -758,21 +758,21 @@ dsDo stmts
...
@@ -758,21 +758,21 @@ dsDo stmts
= ASSERT( length rec_ids > 0 )
= ASSERT( length rec_ids > 0 )
goL (new_bind_stmt : stmts)
goL (new_bind_stmt : stmts)
where
where
new_bind_stmt = L loc $ BindStmt (mkLHsPatTup later_pats)
new_bind_stmt = L loc $ BindStmt (mk
Big
LHsPatTup later_pats)
mfix_app bind_op
mfix_app bind_op
noSyntaxExpr -- Tuple cannot fail
noSyntaxExpr -- Tuple cannot fail
tup_ids = rec_ids ++ filterOut (`elem` rec_ids) later_ids
tup_ids = rec_ids ++ filterOut (`elem` rec_ids) later_ids
tup_ty = mkB
oxed
Tup
le
Ty (map idType tup_ids) -- Deals with singleton case
tup_ty = mkB
igCore
TupTy (map idType tup_ids) -- Deals with singleton case
rec_tup_pats = map nlVarPat tup_ids
rec_tup_pats = map nlVarPat tup_ids
later_pats = rec_tup_pats
later_pats = rec_tup_pats
rets = map noLoc rec_rets
rets = map noLoc rec_rets
mfix_app = nlHsApp (noLoc mfix_op) mfix_arg
mfix_app = nlHsApp (noLoc mfix_op) mfix_arg
mfix_arg = noLoc $ HsLam (MatchGroup [mkSimpleMatch [mfix_pat] body]
mfix_arg = noLoc $ HsLam (MatchGroup [mkSimpleMatch [mfix_pat] body]
(mkFunTy tup_ty body_ty))
(mkFunTy tup_ty body_ty))
mfix_pat = noLoc $ LazyPat $ mkLHsPatTup rec_tup_pats
mfix_pat = noLoc $ LazyPat $ mk
Big
LHsPatTup rec_tup_pats
body = noLoc $ HsDo DoExpr (rec_stmts ++ [ret_stmt]) body_ty
body = noLoc $ HsDo DoExpr (rec_stmts ++ [ret_stmt]) body_ty
ret_app = nlHsApp (noLoc return_op) (mkLHsTup
leExpr
rets)
ret_app = nlHsApp (noLoc return_op) (mk
Big
LHsTup rets)
ret_stmt = noLoc $ mkLastStmt ret_app
ret_stmt = noLoc $ mkLastStmt ret_app
-- This LastStmt will be desugared with dsDo,
-- This LastStmt will be desugared with dsDo,
-- which ignores the return_op in the LastStmt,
-- which ignores the return_op in the LastStmt,
...
...
This diff is collapsed.
Click to expand it.
compiler/typecheck/TcMatches.lhs
+
1
−
1
View file @
d87990fe
...
@@ -803,7 +803,7 @@ tcDoStmt ctxt (RecStmt { recS_stmts = stmts, recS_later_ids = later_names
...
@@ -803,7 +803,7 @@ tcDoStmt ctxt (RecStmt { recS_stmts = stmts, recS_later_ids = later_names
= do { let tup_names = rec_names ++ filterOut (`elem` rec_names) later_names
= do { let tup_names = rec_names ++ filterOut (`elem` rec_names) later_names
; tup_elt_tys <- newFlexiTyVarTys (length tup_names) liftedTypeKind
; tup_elt_tys <- newFlexiTyVarTys (length tup_names) liftedTypeKind
; let tup_ids = zipWith mkLocalId tup_names tup_elt_tys
; let tup_ids = zipWith mkLocalId tup_names tup_elt_tys
tup_ty = mkB
oxed
Tup
le
Ty tup_elt_tys
tup_ty = mkB
igCore
TupTy tup_elt_tys
; tcExtendIdEnv tup_ids $ do
; tcExtendIdEnv tup_ids $ do
{ stmts_ty <- newFlexiTyVarTy liftedTypeKind
{ stmts_ty <- newFlexiTyVarTy liftedTypeKind
...
...
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