File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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---------------------------------------------
Original file line number Diff line number Diff line change @@ -75,13 +75,13 @@ constructor2PatternDec ty idx (NormalC conName argTypes) = do
7575constructor2PatternDec 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 ++ " %" )
8787constructor2PatternDec _ _ _ =
You can’t perform that action at this time.
0 commit comments