Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
curry
curry-frontend
Commits
f8e81a30
Commit
f8e81a30
authored
Aug 28, 2013
by
Björn Peemöller
Browse files
Restricted warning for missing patterns to at most 4 patterns
parent
0ef01d8e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Checks/WarnCheck.hs
View file @
f8e81a30
...
...
@@ -891,11 +891,18 @@ warnMissingPattern :: String -> Position -> [ExhaustivePats] -> Message
warnMissingPattern
loc
p
pats
=
posMessage
p
$
text
"Pattern matches are non-exhaustive"
$+$
text
"In a"
<+>
text
loc
<>
char
':'
$+$
nest
2
(
text
"Patterns not matched:"
$+$
nest
2
(
vcat
(
map
ppExPat
pats
)))
$+$
nest
2
(
text
"Patterns not matched:"
$+$
nest
2
(
vcat
(
ppExPat
s
pats
)))
where
ppExPats
ps
|
length
ps
>
maxMissingPattern
=
ppPats
++
[
text
"..."
]
|
otherwise
=
ppPats
where
ppPats
=
map
ppExPat
(
take
maxMissingPattern
ps
)
ppExPat
(
ps
,
cs
)
|
null
cs
=
ppPats
|
otherwise
=
ppPats
<+>
text
"with"
<+>
hsep
(
map
ppCons
cs
)
where
ppPats
=
hsep
(
map
(
ppPattern
2
)
ps
)
ppCons
(
i
,
lits
)
=
ppIdent
i
<+>
text
"`notElem`"
<+>
ppExpr
0
(
List
[]
(
map
Literal
lits
))
maxMissingPattern
::
Int
maxMissingPattern
=
4
Write
Preview
Supports
Markdown
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