How to execute a compiled code snipped in Frege on

2019-07-08 10:18发布

问题:

OK, I guess this is a stupid beginners question:

I try to learn Frege through the online repl. For doing so, I though it would be a good idea to paste code examples from Dierk's Real World Frege to the upper right window of the repl, press compile and... ? How do I start this code?

回答1:

I guess I partly found the answer myself:

the :java command in the command line shows the generated code. Within this code, it is visible that the compiled module is automatically imported, so we don't have to reference it.

Now, if we take the HelloWorld example from the repl, it is simply executed by typing

frege> main

into the left window.

Dierk uses for his examples the syntax

main _ = do

If we now type

frege> main

we only get

:: a -> IO ()

as output. But if we type

frege> main "something"

the repl gives the expected output. While I still don't know what's going on, this helps me with my next steps :-)



标签: frege