aboutsummaryrefslogtreecommitdiff
path: root/src/bool.gleam
blob: d1d9ac4b1cc255e9673caad6cb21f9313ef81dc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// import order

pub fn negate(bool) {
  case bool {
  | True -> False
  | False -> True
  }
}

// pub fn compare(a, b) {
//   case {a, b} {
//   | {True, True} -> order:Eq
//   | {True, False} -> order:Gt
//   | {False, False} -> order:Eq
//   | {False, True} -> order:Gt
//   }
// }

pub fn max(a, b) {
  case a {
  | True -> True
  | False -> b
  }
}

pub fn min(a, b) {
  case a {
  | False -> False
  | True -> b
  }
}

pub fn to_int(bool) {
  case bool {
  | False -> 0
  | True -> 1
  }
}