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
4,258
Issues
4,258
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
394
Merge Requests
394
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
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
Glasgow Haskell Compiler
GHC
Commits
52b02e66
Commit
52b02e66
authored
Dec 02, 2015
by
Simon Peyton Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments only (isIrrefutablePat)
parent
741f837d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
compiler/hsSyn/HsPat.hs
compiler/hsSyn/HsPat.hs
+6
-2
compiler/rename/RnExpr.hs
compiler/rename/RnExpr.hs
+5
-0
No files found.
compiler/hsSyn/HsPat.hs
View file @
52b02e66
...
...
@@ -540,8 +540,12 @@ isIrrefutableHsPat :: OutputableBndr id => LPat id -> Bool
-- (NB: this is not quite the same as the (silly) defn
-- in 3.17.2 of the Haskell 98 report.)
--
-- isIrrefutableHsPat returns False if it's in doubt; specifically
-- on a ConPatIn it doesn't know the size of the constructor family
-- WARNING: isIrrefutableHsPat returns False if it's in doubt.
-- Specifically on a ConPatIn, which is what it sees for a
-- (LPat Name) in the renamer, it doesn't know the size of the
-- constructor family, so it returns False. Result: only
-- tuple patterns are considered irrefuable at the renamer stage.
--
-- But if it returns True, the pattern is definitely irrefutable
isIrrefutableHsPat
pat
=
go
pat
...
...
compiler/rename/RnExpr.hs
View file @
52b02e66
...
...
@@ -1437,6 +1437,11 @@ ado _ctxt [] tail _ = return (tail, emptyNameSet)
-- the bind form, which would give rise to a Monad constraint.
ado
ctxt
[(
L
_
(
BindStmt
pat
rhs
_
_
),
_
)]
tail
_
|
isIrrefutableHsPat
pat
,
(
False
,
tail'
)
<-
needJoin
tail
-- WARNING: isIrrefutableHsPat on (HsPat Name) doesn't have enough info
-- to know which types have only one constructor. So only
-- tuples come out as irrefutable; other single-constructor
-- types, and newtypes, will not. See the code for
-- isIrrefuatableHsPat
=
mkApplicativeStmt
ctxt
[
ApplicativeArgOne
pat
rhs
]
False
tail'
ado
_ctxt
[(
one
,
_
)]
tail
_
=
return
(
one
:
tail
,
emptyNameSet
)
...
...
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