1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-05 22:46:08 +03:00
juvix/tests/VampIR/positive/Core/test002.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

12 lines
390 B
Plaintext

-- pattern matching
type optbool {
Just : Bool -> optbool;
Nothing : optbool;
};
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;
\(x : Int) \(y : Int) (\(x : Bool) \(o : optbool) { boolToInt (case o of { Just b := if x then true else b; Nothing := false }) }) (intToBool x) (Just (intToBool y))