1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-14 17:32:00 +03:00
juvix/tests/positive/HelloWorld.mjuvix
Paul Cadman dc6fce8820
Add support for compile (by Jonathan) (#66)
* Add support for compile (by Jonathan)

* Remove error related to unsopported backend

Co-authored-by: Jonathan Prieto-Cubides <jonathan.cubides@uib.no>
2022-04-28 17:42:15 +02:00

35 lines
775 B
Plaintext

module HelloWorld;
-- the foreign keyword has two arguments:
-- 1. The name of the backend. Only ghc is available now.
-- 2. A string. For ease of use, the string is given between braces
-- and can have multiple lines. Space at the beginning and at the end is ignored.
-- The given code is inlined verbatim when compiling to the given backend.
foreign ghc {
import Data.Text
import Data.Text.IO
};
axiom Action : Type;
compile Action {
ghc ↦ "IO ()";
};
axiom String : Type;
axiom putStr : String -> Action;
-- the compile keyword has three arguments:
-- 1. The name of the MiniJuvix Axiom.
-- 2. The name of the backend.
-- 3. The thing we should inline when compiling this
-- axiom to the given backend.
-- main : Action;
-- main := putStr "hello world";
end;