mirror of
https://github.com/anoma/juvix.git
synced 2025-01-05 22:46:08 +03:00
336a934d18
* Closes #2032. * Adds the `juvix dev core normalize` command. * Adds the `:n` command in JuvixCore REPL. * Adds the `--normalize` flag to `juvix dev core read` and `juvix dev core from-concrete`. * Adds `pipeline-normalize` which denotes pipeline steps necessary before normalization. * Adds normalization tests in `tests/VampIR/positive/Core`.
17 lines
405 B
Plaintext
17 lines
405 B
Plaintext
-- inductive types
|
|
|
|
def intToBool : Int -> Bool := \(x : Int) if x = 0 then false else true;
|
|
def boolToInt : Bool -> Int := \(x : Bool) if x then 1 else 0;
|
|
|
|
type enum {
|
|
opt0 : enum;
|
|
opt1 : Bool -> enum;
|
|
opt2 : Bool -> Bool -> enum;
|
|
};
|
|
|
|
\(x : Int) \(y : Int) (\(e : enum) boolToInt (case e of {
|
|
opt0 := false;
|
|
opt1 b := b;
|
|
opt2 b c := if b then b else c;
|
|
})) (opt2 (intToBool x) (intToBool y))
|