mirror of
https://github.com/anoma/juvix.git
synced 2025-01-05 22:46:08 +03:00
21d5034e60
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
62 lines
1.0 KiB
Plaintext
62 lines
1.0 KiB
Plaintext
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';
|