类型检查生成的代码可访问 Haskell 中动态加载的代码

发布于 2024-12-29 16:25:46 字数 387 浏览 2 评论 0原文

我需要一种快速的方法(每秒 1000 次类型检查)来对生成的 Haskell 源代码进行类型检查。

我们尝试了 hint ,它足够快,但它无法访问动态加载的代码,除非源代码可用,而我们在一些情况。也许有某种方法可以将动态加载的代码注册为包或其他东西,因为提示似乎可以访问已注册的包?

我们尝试使用 ghc api,但它似乎要求文件位于磁盘上,并且所需的所有文件 IO 使其速度太慢。

我们可以使用 haskell-src-exts 来生成代码,但我们需要对其进行类型检查。

I need a fast way (1000's of typechecks per second) to typecheck generated Haskell source code.

We tried hint which was fast enough except it cannot access dynamically loaded code unless the source code is available which we would not have in some cases. Maybe there is some way to register dynamically loaded code as a package or something since hint can access registered packages it seems?

We tried using the ghc api, but it appears to require the files be on disk and all the file IO required makes it too slow.

We can use haskell-src-exts to generate the code, but we need to typecheck it.

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

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

发布评论

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

评论(1

离笑几人歌 2025-01-05 16:25:46

每秒进行数千次类型检查似乎不太可行——您正在同时执行这些操作,我希望有一些并行性的希望?

我假设您支持完整的 GHC 类型系统?因此,精简的类型检查器(例如 THIH 是不够的)。

  • 使用 ghc-api,带有字节码且无优化
  • 将所有内容缓存在内存中
  • 向 GHC 提交修改,以确保它可以在必要时从内存缓冲区中获取 FD

Thousands of type checks per second doesn't seem feasible sequentially -- you're doing these concurrently, with some hope for parallelism I hope?

And I assume you are supporting the full GHC type system? So a stripped down type checker (e.g. THIH won't suffice).

  • Use ghc-api, with bytecode and no optimizations
  • Cache everything in memory
  • Submit modifications to GHC to ensure it can take FDs from memory buffers, if necessary
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文