Skip to content

Commit e81d84a

Browse files
committed
Resolve some warnings about incomplete patterns
1 parent 74a6ae2 commit e81d84a

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/Test/StrictCheck/Produce.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ draws inputs = go [inputs]
167167
pick :: [a] -> Gen (a, [a])
168168
pick as = do
169169
index <- choose (0, length as - 1)
170-
let (before, picked : after) = splitAt index as
171-
return (picked, before ++ after)
172-
170+
case splitAt index as of
171+
(before, picked : after) -> return (picked, before ++ after)
172+
_ -> error "pick: empty list"
173173

174174

175175
---------------------------------------------

src/Test/StrictCheck/TH.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ constructor2PatternDec ty idx (NormalC conName argTypes) = do
7575
constructor2PatternDec ty idx (InfixC argType1 conName argType2) = do
7676
let argTypes = [argType1, argType2]
7777
(npPat, names) <- productPattern (map snd argTypes)
78-
when (length names /= 2) $
79-
reportError "The impossible happened: Infix Pattern have more than 2 binders"
80-
let nm1 : nm2 : _ = names
81-
return
82-
( PatSynSigD patDecName (patternTypeDec (map snd argTypes) ty),
83-
infixPatternDec idx patDecName nm1 nm2 npPat
84-
)
78+
case names of
79+
nm1 : nm2 : _ ->
80+
return
81+
( PatSynSigD patDecName (patternTypeDec (map snd argTypes) ty),
82+
infixPatternDec idx patDecName nm1 nm2 npPat
83+
)
84+
_ -> reportError "The impossible happened: Infix Pattern have more than 2 binders"
8585
where
8686
patDecName = mkName (nameBase conName ++ "%")
8787
constructor2PatternDec _ _ _ =

0 commit comments

Comments
 (0)