Skip to content

Commit

Permalink
Update stdlib to remove non-ASCII indentifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcadman committed Jun 25, 2024
1 parent 694d46f commit ff98ad2
Show file tree
Hide file tree
Showing 145 changed files with 508 additions and 508 deletions.
10 changes: 5 additions & 5 deletions examples/demo/Demo.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ sort {A} {{Ord A}} : List A → List A
printNatListLn : List Nat → IO
| nil := printStringLn "nil"
| (x :: xs) :=
printNat x >> printString " :: " >> printNatListLn xs;
printNat x >>> printString " :: " >>> printNatListLn xs;

main : IO :=
printStringLn "Hello!"
>> printNatListLn (preorder (mirror tree))
>> printNatListLn (sort (preorder (mirror tree)))
>> printNatLn (log2 3)
>> printNatLn (log2 130);
>>> printNatListLn (preorder (mirror tree))
>>> printNatListLn (sort (preorder (mirror tree)))
>>> printNatLn (log2 3)
>>> printNatLn (log2 130);
2 changes: 1 addition & 1 deletion examples/milestone/Bank/Bank.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ open Token;

--- This module defines the type for balances and its associated operations.
module Balances;
Balances : Type := List (Field × Nat);
Balances : Type := List (Pair Field Nat);

--- Increments the amount associated with a certain ;Field;.
increment : Field -> Nat -> Balances -> Balances
Expand Down
8 changes: 4 additions & 4 deletions examples/milestone/Collatz/Collatz.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ collatz : Nat → Nat

terminating
run (f : Nat → Nat) : Nat → IO
| (suc zero) := printNatLn 1 >> printStringLn "Finished!"
| n := printNatLn n >> run f (f n);
| (suc zero) := printNatLn 1 >>> printStringLn "Finished!"
| n := printNatLn n >>> run f (f n);

welcome : String :=
"Collatz calculator\n------------------\n\nType a number then ENTER";
Expand All @@ -22,7 +22,7 @@ resultHeading : String := "Collatz sequence:";

main : IO :=
printStringLn welcome
>> readLn
>>> readLn
λ {s :=
printStringLn resultHeading
>> run collatz (stringToNat s)};
>>> run collatz (stringToNat s)};
3 changes: 2 additions & 1 deletion examples/milestone/Fibonacci/Fibonacci.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ fib : Nat → Nat → Nat → Nat

fibonacci (n : Nat) : Nat := fib n 0 1;

main : IO := readLn (printNatLn ∘ fibonacci ∘ stringToNat);
main : IO :=
readLn (stringToNat >> fibonacci >> printNatLn);
9 changes: 5 additions & 4 deletions examples/milestone/TicTacToe/CLI/TicTacToe.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ prompt (x : GameState) : String :=
++str ": ";

nextMove (s : GameState) : String → GameState :=
flip playMove s ∘ validMove ∘ stringToNat;
stringToNat >> validMove >> flip playMove s;

--- Main loop
terminating
Expand All @@ -30,12 +30,13 @@ run : GameState → IO
++str msg)
| (state b p (continue msg)) :=
printString (msg ++str prompt (state b p noError))
>> readLn (run ∘ nextMove (state b p noError))
| x := printString (prompt x) >> readLn (run ∘ nextMove x);
>>> readLn (run << nextMove (state b p noError))
| x :=
printString (prompt x) >>> readLn (run << nextMove x);

--- The welcome message
welcome : String :=
"MiniTicTacToe\n-------------\n\nType a number then ENTER to make a move";

--- The entry point of the program
main : IO := printStringLn welcome >> run beginState;
main : IO := printStringLn welcome >>> run beginState;
2 changes: 1 addition & 1 deletion test/Compilation/Positive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ tests =
$(mkRelFile "test050.juvix")
$(mkRelFile "out/test050.out"),
posTest
"Test051: Local recursive function using IO >>"
"Test051: Local recursive function using IO >>>"
$(mkRelDir ".")
$(mkRelFile "test051.juvix")
$(mkRelFile "out/test051.out"),
Expand Down
8 changes: 4 additions & 4 deletions tests/Anoma/Compilation/positive/test003.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Stdlib.Debug.Trace open;

main : Nat :=
trace (mod 3 2)
>>> trace (div 18 4)
>>> trace (mod 18 4)
>>> trace (div 16 4)
>>> mod 16 4;
>-> trace (div 18 4)
>-> trace (mod 18 4)
>-> trace (div 16 4)
>-> mod 16 4;
4 changes: 2 additions & 2 deletions tests/Anoma/Compilation/positive/test006.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ loop : Nat := loop;
main : Bool :=
trace
(if (3 > 0) 1 loop + if (2 < 1) loop (if (7 >= 8) loop 1))
>>> trace (2 > 0 || loop == 0)
>>> 2 < 0 && loop == 0;
>-> trace (2 > 0 || loop == 0)
>-> 2 < 0 && loop == 0;
14 changes: 7 additions & 7 deletions tests/Anoma/Compilation/positive/test007.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ lst : List Nat := 0 :: 1 :: nil;

main : List Nat :=
trace (null lst)
>>> trace (null (nil {Nat}))
>>> trace (head 1 lst)
>>> trace (tail lst)
>>> trace (head 0 (tail lst))
>>> trace (map ((+) 1) lst)
>>> map' ((+) 1) lst
>-> trace (null (nil {Nat}))
>-> trace (head 1 lst)
>-> trace (tail lst)
>-> trace (head 0 (tail lst))
>-> trace (map ((+) 1) lst)
>-> map' ((+) 1) lst
-- TODO: Restore when anoma backend supports strings
-- >>> runPartial λ {{{_}} := map'' ((+) 1) lst};
-- >-> runPartial λ {{{_}} := map'' ((+) 1) lst};
6 changes: 3 additions & 3 deletions tests/Anoma/Compilation/positive/test009.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ fact : Nat → Nat := fact' 1;

main (n : Nat) : Nat :=
trace (sum n)
>>> trace (fact 5)
>>> trace (fact 10)
>>> fact 12;
>-> trace (fact 5)
>-> trace (fact 10)
>-> fact 12;
4 changes: 2 additions & 2 deletions tests/Anoma/Compilation/positive/test011.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ fib : Nat → Nat := fib' 0 1;

main : Nat :=
trace (fib 10)
>>> trace (fib 100)
>>> fib 1000;
>-> trace (fib 100)
>-> fib 1000;
8 changes: 4 additions & 4 deletions tests/Anoma/Compilation/positive/test012.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ combineDigits (xs : List Nat) : Nat := for (acc := 0) (x in xs) acc * 10 + x;

main : Nat :=
trace (combineDigits (preorder (gen 3)))
>>> trace (combineDigits (preorder (gen 4)))
>>> trace (combineDigits (preorder (gen 5)))
>>> trace (combineDigits (preorder (gen 6)))
>>> combineDigits (preorder (gen 7));
>-> trace (combineDigits (preorder (gen 4)))
>-> trace (combineDigits (preorder (gen 5)))
>-> trace (combineDigits (preorder (gen 6)))
>-> combineDigits (preorder (gen 7));
6 changes: 3 additions & 3 deletions tests/Anoma/Compilation/positive/test013.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ f : Nat → Nat → Nat

main : Nat :=
trace (f 5 6)
>>> trace (f 6 5)
>>> trace (f 10 5)
>>> f 11 5;
>-> trace (f 6 5)
>-> trace (f 10 5)
>-> f 11 5;
6 changes: 3 additions & 3 deletions tests/Anoma/Compilation/positive/test014.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ vy : Nat := 7;

main : Nat :=
trace (func (div y x))
>>> -- 17 div 5 + 4 = 7
>-> -- 17 div 5 + 4 = 7
trace
(y + x * z)
>>> -- 17
>-> -- 17
trace
(vx + vy * (z + 1))
>>> -- 37
>-> -- 37
f
(h g 2 3)
4;
Expand Down
10 changes: 5 additions & 5 deletions tests/Anoma/Compilation/positive/test015.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ h : Nat → Nat

main : Nat :=
trace (f 100 500)
>>> -- 600
>-> -- 600
trace
(f 5 0)
>>> -- 25
>-> -- 25
trace
(f 5 5)
>>> -- 30
>-> -- 30
trace
(h 10)
>>> -- 45
>-> -- 45
trace
(g 10 h)
>>> -- 55
>-> -- 55
g
3
(f 10);
16 changes: 8 additions & 8 deletions tests/Anoma/Compilation/positive/test020.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ subp : Nat → Nat → Nat

main : Nat :=
trace (f91 101)
>>> trace (f91 95)
>>> trace (f91 16)
>>> trace (f91 5)
>>> trace (subp 101 1)
>>> trace (subp 11 5)
>>> trace (subp 10 4)
>>> trace (subp 1000 600)
>>> subp 10000 6000;
>-> trace (f91 95)
>-> trace (f91 16)
>-> trace (f91 5)
>-> trace (subp 101 1)
>-> trace (subp 11 5)
>-> trace (subp 10 4)
>-> trace (subp 1000 600)
>-> subp 10000 6000;
2 changes: 1 addition & 1 deletion tests/Anoma/Compilation/positive/test021.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ power' : Nat → Nat → Nat → Nat
power : Nat → Nat → Nat := power' 1;

main : Nat :=
trace (power 2 3) >>> trace (power 3 7) >>> power 5 11;
trace (power 2 3) >-> trace (power 3 7) >-> power 5 11;
12 changes: 6 additions & 6 deletions tests/Anoma/Compilation/positive/test022.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ sum' : Nat → Nat
printListNatLn : List Nat → IO
| nil := printStringLn "nil"
| (h :: t) :=
printNat h >> printString " :: " >> printListNatLn t;
printNat h >>> printString " :: " >>> printListNatLn t;

main (n : Nat) : Nat :=
trace (gen 10)
>>> trace (reverse (gen 10))
>>> trace (filter ((<) 5) (gen 10))
>>> trace (reverse (map (flip sub 1) (gen 10)))
>>> trace (sum n)
>>> sum' n;
>-> trace (reverse (gen 10))
>-> trace (filter ((<) 5) (gen 10))
>-> trace (reverse (map (flip sub 1) (gen 10)))
>-> trace (sum n)
>-> sum' n;
2 changes: 1 addition & 1 deletion tests/Anoma/Compilation/positive/test023.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ terminating
h : Nat → Nat
| x := if (x < 1) 1 (x * f (sub x 1));

main : Nat := trace (f 5) >>> trace (f 10) >>> f 20;
main : Nat := trace (f 5) >-> trace (f 10) >-> f 20;
8 changes: 4 additions & 4 deletions tests/Anoma/Compilation/positive/test025.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ gcd : Nat → Nat → Nat

main : Nat :=
trace (gcd (3 * 7 * 2) (7 * 2 * 11))
>>> trace (gcd (3 * 7 * 2 * 11 * 5) (7 * 2 * 5))
>>> trace (gcd 3 7)
>>> trace (gcd 7 3)
>>> gcd (11 * 7 * 3) (2 * 5 * 13);
>-> trace (gcd (3 * 7 * 2 * 11 * 5) (7 * 2 * 5))
>-> trace (gcd 3 7)
>-> trace (gcd 7 3)
>-> gcd (11 * 7 * 3) (2 * 5 * 13);
2 changes: 1 addition & 1 deletion tests/Anoma/Compilation/positive/test026.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ drop_front : {A : Type} → Queue A → Queue A
| nil := queue (reverse (qsnd q')) nil
| _ := q';

pop_front {A} : Queue A -> Maybe (A × Queue A)
pop_front {A} : Queue A -> Maybe (Pair A (Queue A))
| (queue xs ys) :=
case xs of
| h :: t := just (h, queue t ys)
Expand Down
10 changes: 5 additions & 5 deletions tests/Anoma/Compilation/positive/test027.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ czero : Num
| {_} f x := x;

csuc : Num → Num
| n {_} f := f n {_} f;
| n {_} f := f << n {_} f;

num : Nat → Num
| zero := czero
| (suc n) := csuc (num n);

add : Num → Num → Num
| n m {_} f := n {_} f m {_} f;
| n m {_} f := n {_} f << m {_} f;

mul : Num → Num → Num
| n m {_} := n {_} m {_};
| n m {_} := n {_} << m {_};

isZero : Num → Bool
| n := n {_} (const false) true;
Expand All @@ -30,5 +30,5 @@ toNat : Num → Nat

main : Nat :=
trace (toNat (num 7))
>>> trace (toNat (add (num 7) (num 3)))
>>> toNat (mul (num 7) (num 3));
>-> trace (toNat (add (num 7) (num 3)))
>-> toNat (mul (num 7) (num 3));
2 changes: 1 addition & 1 deletion tests/Anoma/Compilation/positive/test028.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ primes : Unit → Stream := eratostenes (numbers 2);

main (n1 n2 : Nat) : Nat :=
trace (snth n1 primes)
>>> snth n2 primes;
>-> snth n2 primes;
8 changes: 4 additions & 4 deletions tests/Anoma/Compilation/positive/test029.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ack : Nat → Nat → Nat

main : Nat :=
trace (ack 0 7)
>>> trace (ack 1 7)
>>> trace (ack 1 13)
>>> trace (ack 2 7)
>>> ack 2 13;
>-> trace (ack 1 7)
>-> trace (ack 1 13)
>-> trace (ack 2 7)
>-> ack 2 13;
8 changes: 4 additions & 4 deletions tests/Anoma/Compilation/positive/test030.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ iterate : {A : Type} → (A → A) → Nat → A → A
-- clauses with differing number of patterns not yet supported
-- iterate f zero x := x;
| f zero := id
| f (suc n) := f iterate f n;
| f (suc n) := f << iterate f n;

plus : Nat → Nat → Nat := iterate suc;

Expand All @@ -23,6 +23,6 @@ ackermann : Nat → Nat → Nat

main : Nat :=
trace (plus 3 7)
>>> trace (mult 3 7)
>>> trace (exp 3 7)
>>> ackermann 1 13;
>-> trace (mult 3 7)
>-> trace (exp 3 7)
>-> ackermann 1 13;
6 changes: 3 additions & 3 deletions tests/Anoma/Compilation/positive/test032.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module test032;
import Stdlib.Prelude open;
import Stdlib.Debug.Trace open;

split : {A : Type} → Nat → List A → List A × List A
split : {A : Type} → Nat → List A → Pair (List A) (List A)
| zero xs := nil, xs
| (suc n) nil := nil, nil
| (suc n) (x :: xs) :=
Expand Down Expand Up @@ -46,5 +46,5 @@ gen2 : List (List Nat) → Nat → Nat → List (List Nat)

main : List Nat :=
trace (take 10 (uniq (sort (flatten (gen2 nil 6 10)))))
>>> trace (take 10 (uniq (sort (flatten (gen2 nil 7 10)))))
>>> take 10 (uniq (sort (flatten (gen2 nil 6 20))));
>-> trace (take 10 (uniq (sort (flatten (gen2 nil 7 10)))))
>-> take 10 (uniq (sort (flatten (gen2 nil 6 20))));
Loading

0 comments on commit ff98ad2

Please sign in to comment.