aboutsummaryrefslogtreecommitdiff
path: root/gen/src/gleam@bool.erl
blob: 671426179447d648064bdc5bc889703c55e038cc (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
-module(gleam@bool).
-compile(no_auto_import).

-export([negate/1, compare/2, max/2, min/2, to_int/1]).

negate(Bool) ->
    case Bool of
        true ->
            false;

        false ->
            true
    end.

compare(A, B) ->
    case {A, B} of
        {true, true} ->
            eq;

        {true, false} ->
            gt;

        {false, false} ->
            eq;

        {false, true} ->
            lt
    end.

max(A, B) ->
    case A of
        true ->
            true;

        false ->
            B
    end.

min(A, B) ->
    case A of
        false ->
            false;

        true ->
            B
    end.

to_int(Bool) ->
    case Bool of
        false ->
            0;

        true ->
            1
    end.