on 2aa7dcd help sign in
elk/src/Reporting/Warning/CheckMatch.hs
28 lines 788 B history raw
1module Reporting.Warning.CheckMatch where
3import qualified AST.Pattern as Pattern
4import qualified AST.Literal as Literal
5import qualified Data.Set as Set
6import qualified AST.Variable as Var
8data Pat var
9 = Data var [Pat var]
10 | Record [String]
11 | Alias String (Pat var)
12 | Var String
13 | Anything
14 | Literal Literal.Literal
15 -- It's a shame that I had to replicate the entire pattern type, but it's
16 -- essential to have this constructor.
17 | AnythingBut (Set.Set Literal.Literal)
18 deriving (Show, Eq)
20type CanonicalPat =
21 Pat Var.Canonical
23data Warning
24 = Redundant Pattern.CanonicalPattern
25 -- The argument is the list of patterns that would have to
26 -- be added for the case expression to be exhaustive.
27 | Inexhaustive [CanonicalPat]