1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-14 08:27:03 +03:00
juvix/tests/positive/MiniHaskell/HelloWorld.juvix
janmasrovira 803d2008d9
remove ≔ from the language and replace it by := (#1563)
* remove ≔ from the language and replace it by :=

* revert accidental changes in juvix input mode

* update stdlib submodule

* rename ℕ by Nat in the tests and examples

* fix shell tests
2022-09-30 10:55:32 +10:00

53 lines
754 B
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 HelloWorld;
inductive {
zero : ;
suc : ;
};
inductive V {
zeroV : V;
sucV : V;
};
infixl 6 +;
+ : ;
+ zero b := b;
+ (suc a) b := suc (a + b);
infixl 7 *;
* : ;
* zero b := zero;
* (suc a) b := b + (a * b);
axiom Action : Type;
compile Action {
ghc ↦ "IO ()";
};
infixl 1 >>;
axiom >> : Action → Action → Action;
compile >> {
ghc ↦ "(>>)";
};
axiom String : Type;
axiom putStr : String → Action;
compile putStr {
ghc ↦ "putStrLn";
};
doTimes : → Action → Action;
doTimes zero _ := putStr "done";
doTimes (suc n) a := a >> doTimes n a;
three : ;
three := suc (suc (suc zero));
main : Action;
main := doTimes three (putStr "hello world");
end;