module HelloWorld; -- the foreign keyword has two arguments: -- 1. The name of the backend. -- 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 }; foreign c { #include }; axiom Action : Type; compile Action { ghc ↦ "IO ()"; c ↦ "int"; }; axiom String : Type; compile String { ghc ↦ "[Char]"; c ↦ "char*"; }; axiom putStrLn : String -> Action; compile putStrLn { ghc ↦ "putStrLn"; c ↦ "puts"; }; main : Action; main := putStrLn "hello world"; end;