lisette_semantics/pattern_analysis/
types.rs1use rustc_hash::FxHashMap as HashMap;
2
3use syntax::ast::Literal;
4
5pub type TagId = String;
6pub type TypeName = String;
7
8pub type Row = Vec<NormalizedPattern>;
9
10#[derive(Clone, Debug, PartialEq, Eq, Hash)]
11pub struct Constructor {
12 pub tag_id: TagId,
13 pub arity: usize,
14}
15
16pub type Union = Vec<Constructor>;
17
18#[derive(Clone, Debug, PartialEq)]
19pub enum NormalizedPattern {
20 Wildcard,
21 Literal(Literal),
22 Constructor {
23 type_name: TypeName,
24 tag: TagId,
25 args: Vec<NormalizedPattern>,
26 },
27}
28
29pub type UnionTable = HashMap<TypeName, Union>;