Android 上的 Haskell 解释器?

发布于 2024-11-04 16:30:14 字数 1459 浏览 4 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

何时共饮酒 2024-11-11 16:30:15

令人惊讶的是,我找不到任何现有的 Android Haskell 解释器。

但这里有一些为脚本层编写自己的解释器的说明安卓。假设您愿意尝试将 haskell 函数映射到 Java android 函数之上(我知道这不是一个完美的解决方案)。您还需要参考他们为 Scala 编写的脚本层,因为这是最接近 Haskell 的脚本层(我承认这不是很接近)。

否则,没有任何理由不能直接编译这些 Haskell 实现对于 Android,使用 NDK。只要它们是用 C 语言编写的,就应该可以在 Android 上运行。对于 C++,这有点棘手,因为 Android 没有所有 C++ 头文件。

Surprisingly, I couldn't uncover any existing Haskell interpreter for Android.

But here are some instructions for writing your own interpreter for the Scripting Layer on Android. That's assuming you're willing to try mapping the haskell functions on top of the Java android ones (which is not a perfect solution, I know). You'll also want to refer to their scripting layer written for Scala, because that's the one that comes closest to Haskell (which is not very close I admit).

Otherwise, there shouldn't be any reason why any of those Haskell implementations couldn't be directly compiled for Android using the NDK. As long as they're written in C, they should work on Android. For C++, that's a little bit more tricky since Android doesn't have all the C++ headers.

去了角落 2024-11-11 16:30:14

Hugs 是用 C 语言编写的,非常可移植。应该可以移植到Android上。

Hugs is written in C and quite portable. It should be possible to port it to Android.

执手闯天涯 2024-11-11 16:30:14

根据 imz 的说明,您所需要的只是

  • ConnectBot 或类似的
  • 远程计算机
    • Vim、Emacs 或类似产品
    • runghc / ghci / Hugs / yourfavoritehaskellinterpreterorcompiler

它不像专用应用程序或脚本层那么可靠,但老实说,对于您的用例,它将提供几乎完全相同的功能 作为这些选项(如果不是更多)。它就像网站一样“移动”(仅取决于主机的正常运行时间和客户端的连接)。

Taking a note from imz, all you need is

  • ConnectBot or similar
  • A remote machine with
    • Vim, Emacs, or similar
    • runghc / ghci / hugs / yourfavoritehaskellinterpreterorcompiler

It's not as solid as a dedicated app or scripting layer would be, but honestly, for your use cases, it would provide almost exactly the same functionality as those options (if not more). And it would be just as "mobile" as a website (depends only on the uptime of the host and the connectivity of the client).

-柠檬树下少年和吉他 2024-11-11 16:30:14

您可以通过移动浏览器使用 tryhaskell.org。它将接受任何有效的表达式,但请记住,无法定义您自己的数据类型。

You can use tryhaskell.org from your mobile browser. It will accept any valid expression, but keep in mind that defining your own data types won't be possible.

私野 2024-11-11 16:30:14

对于一些负面信息,我在 Android 上看到的 GHC 的所有工作(例如 http://ipwnstudios.com/) 基于交叉编译,而不是为 android 或 ARM 构建 GHC。

For some negative information, all the work I've seen for GHC on Android (such as http://ipwnstudios.com/) is based on cross-compilation, rather than building GHC for android or ARM.

岁月如刀 2024-11-11 16:30:14

我刚刚在 Android Market 中找到了 IDEone,它将您的代码发送到在线服务。它可以工作,但是在 Android 上编程并不是很有趣。顺便说一句:如果您不想注册,请参阅 BugMeNot

I just found IDEone in the Android Market, which sends your code to an online service. It works, but programming on Android isn't much fun. Btw: In case you don't want to register see BugMeNot

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文