1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-05 22:46:08 +03:00
juvix/tests/positive/Alias.juvix
Jonathan Cubides 21d5034e60
Fix formatting for all Juvix files in tests folder (#2404)
In this PR, we ran the Juvix formatter so that we can now freely run
`make format`, `make check`, or `make pre-commit` without any unexpected
file changes.

This goes after:

- https://github.com/anoma/juvix/pull/2486
2023-10-31 18:36:34 +01:00

62 lines
1.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module Alias;
import Stdlib.Data.Fixity open;
-- aliases are allowed to forward reference
syntax alias Boolean := Bool;
syntax alias ⊥ := false;
syntax alias := true;
--- Truth value
type Bool :=
| false
| true;
not : Boolean -> Boolean
| ⊥ :=
| := ⊥;
not2 (b : Boolean) : Boolean :=
let
syntax alias yes := ;
syntax alias no := ⊥;
in case b of {
| no := yes
| yes := no
};
module ExportAlias;
syntax alias Binary := Bool;
syntax alias one := ;
syntax alias zero := ⊥;
end;
open ExportAlias;
syntax operator || logical;
|| : Binary -> Binary -> Binary
| zero b := b
| one _ := one;
syntax operator or none;
syntax alias or := ||;
syntax alias ||| := ||;
or3 (a b c : Binary) : Binary := or (or a b) c;
or3' (a b c : Binary) : Binary := (a ||| b) ||| c;
type Pair := mkPair Binary Binary;
syntax operator , pair;
syntax alias , := mkPair;
myPair : Pair := one, ⊥;
localAlias : Binary -> Binary
| b :=
let
syntax alias b' := b;
in b';