1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-05 22:46:08 +03:00
juvix/tests/VampIR/positive/Core/test008.jvc
Łukasz Czajka 336a934d18
Normalization by Evaluation (#2038)
* 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`.
2023-05-15 18:01:40 +02:00

22 lines
560 B
Plaintext

-- higher-order 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 -> Bool) -> enum;
opt3 : Bool -> (Bool -> Bool -> Bool) -> Bool -> enum;
};
\(x : Int) \(y : Int)
boolToInt (
(\(e : enum) case e of {
opt0 := false;
opt1 b := b;
opt2 b f := f b;
opt3 b1 f b2 := f b1 b2;
}) (opt3 (intToBool x) (\(x : Bool) \(y : Bool) if y then false else x) (intToBool y))
)