2022-03-17 01:40:44 +03:00
|
|
|
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
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-03-18 12:16:43 +03:00
|
|
|
axiom Action : Type {
|
|
|
|
ghc ↦ "IO ()";
|
2022-03-23 18:34:08 +03:00
|
|
|
agda ↦ "void";
|
2022-03-18 12:16:43 +03:00
|
|
|
};
|
|
|
|
|
2022-03-17 01:40:44 +03:00
|
|
|
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.
|
2022-03-18 12:16:43 +03:00
|
|
|
|
2022-03-17 01:40:44 +03:00
|
|
|
|
2022-03-17 20:18:10 +03:00
|
|
|
-- main : Action;
|
|
|
|
-- main := putStr "hello world";
|
2022-03-17 01:40:44 +03:00
|
|
|
|
2022-03-23 18:34:08 +03:00
|
|
|
end;
|