git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix true not being treated as an infallible guard
commitac586930069cf490e60fc98f6f600215157b4dd5 authorGary Burgess <gary.burgess@gmail.com> dateMon 29 Feb 2016, 15:15 (11 years ago) parent3732373
1 file changed+5−3
src/Language/PureScript/Linter/Exhaustive.hs+5−3
src/Language/PureScript/Linter/Exhaustive.hs+5−3
@@ -201,9 +201,11 @@ isExhaustiveGuard :: Either [(Guard, Expr)] Expr -> Bool
201201isExhaustiveGuard (Left gs) = not . null $ filter (\(g, _) -> isOtherwise g) gs
202202 where
203203 isOtherwise :: Expr -> Bool
204− isOtherwise (TypedValue _ (BooleanLiteral True) _) = True
205− isOtherwise (TypedValue _ (Var (Qualified (Just (ModuleName [ProperName "Prelude"])) (Ident "otherwise"))) _) = True
206− isOtherwise (TypedValue _ (Var (Qualified (Just (ModuleName [ProperName "Data", ProperName "Boolean"])) (Ident "otherwise"))) _) = True
204+ isOtherwise (BooleanLiteral True) = True
205+ isOtherwise (Var (Qualified (Just (ModuleName [ProperName "Prelude"])) (Ident "otherwise"))) = True
206+ isOtherwise (Var (Qualified (Just (ModuleName [ProperName "Data", ProperName "Boolean"])) (Ident "otherwise"))) = True
207+ isOtherwise (TypedValue _ e _) = isOtherwise e
208+ isOtherwise (PositionedValue _ _ e) = isOtherwise e
207209 isOtherwise _ = False
208210isExhaustiveGuard (Right _) = True
209211