简体   繁体   English

如何执行在 Frege online repl 中剪下的编译代码

[英]How to execute a compiled code snipped in Frege online repl

OK, I guess this is a stupid beginners question:好的,我想这是一个愚蠢的初学者问题:

I try to learn Frege through the online repl.我尝试通过在线 repl 来学习 Frege。 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... ?为此,我认为将Dierk 的 Real World Frege中的代码示例粘贴到 repl 的右上角窗口是个好主意,然后按 compile 和...? How do I start this code?我如何开始这段代码?

I guess I partly found the answer myself:我想我自己部分找到了答案:

the :java command in the command line shows the generated code.命令行中的:java命令显示生成的代码。 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现在,如果我们从 repl 中获取 HelloWorld 示例,只需键入

frege> main

into the left window.进入左侧窗口。

Dierk uses for his examples the syntax Dierk 在他的例子中使用了语法

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. repl 给出了预期的输出。 While I still don't know what's going on, this helps me with my next steps :-)虽然我仍然不知道发生了什么,但这有助于我进行下一步:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM