可以将Agda用作库吗?

编程入门 行业动态 更新时间:2024-10-28 19:28:51
本文介绍了可以将Agda用作库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

除了可以在文件系统(带有EMACS,终端等)上使用Agda之外,还可以直接从Haskell作为库使用它吗?例如:

Instead of using Agda on a filesystem (with EMACS, terminal, etc.), is it possible to use it directly from Haskell, as a library? For example:

-- UsingAgda.hs import Agda -- Prints the type of a term on some Agda code main :: IO () main = typeOf "true" agdaCode where agdaCode :: String agdaCode = unlines ["module Hello where " ," " ,"data Bool : Set where" ," true : Bool " ," false : Bool "]

上面的代码将输出Bool,因为该Agda代码上的true : Bool.

The code above would output Bool, because true : Bool on that Agda code.

推荐答案

是的,有可能. Agda被设计为Haskell库和一个主要模块.

Yes, it is possible. Agda was designed as a Haskell library plus a main module.

您可以在此处看到几个小示例.作为一个更大的例子,我写了 Apia (无耻插件),它使用Agda作为库.

You can see a couple of small examples here. As a bigger example, I wrote Apia (shameless plug), which uses Agda as a library.

请记住,当前 Agda 说明说:

Please keep in mind that the current Agda description says:

请注意,Agda软件包不遵循软件包版本控制 政策,因为它不打算由第三方程序包使用.

Note that the Agda package does not follow the package versioning policy, because it is not intended to be used by third-party packages.

当然,它可能会改变.

更多推荐

可以将Agda用作库吗?

本文发布于:2023-11-13 21:10:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585328.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Agda

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!