为什么 GHC 找不到模块“Language.Java.Inline.Plugin”?

发布于 2025-01-12 12:23:07 字数 1189 浏览 5 评论 0原文

我正在尝试使用

I am importing inline-java in the extra-deps in stack.yaml 进行堆栈构建,如下所示:

extra-deps:
  - inline-java-0.8.4@sha256:9862ba980b40792af5f3e29c52929e35ce3e9733d498a0324049b6b1001509ef,1652

这是我的程序:

{-# LANGUAGE QuasiQuotes #-}
{-# OPTIONS_GHC -fplugin=Language.Java.Inline.Plugin #-}
import Language.Java (withJVM)
import Language.Java.Inline
module Main where


main :: IO ()
main = withJVM [] [java| { System.out.println("Hello Java!"); } |]

但我收到此错误:

Preprocessing executable 'MyProject-exe' for MyProject-0.1.0.0..
Building executable 'MyProject-exe' for MyProject-0.1.0.0..
<command line>: Could not find module `Language.Java.Inline.Plugin'
Use -v (or `:set -v` in ghci) to see a list of the files searched for.

--  While building package MyProject-0.1.0.0 (scroll up to its section to see the error) using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.2.1.0_ghc-8.10.7.exe --builddir=.stack-work\dist\274b403a build lib:MyProject exe:MyProject-exe --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

我做错了什么?

I am trying to stack build using

I am importing inline-java in the extra-deps in stack.yaml, like this:

extra-deps:
  - inline-java-0.8.4@sha256:9862ba980b40792af5f3e29c52929e35ce3e9733d498a0324049b6b1001509ef,1652

Here is my program:

{-# LANGUAGE QuasiQuotes #-}
{-# OPTIONS_GHC -fplugin=Language.Java.Inline.Plugin #-}
import Language.Java (withJVM)
import Language.Java.Inline
module Main where


main :: IO ()
main = withJVM [] [java| { System.out.println("Hello Java!"); } |]

Yet I am getting this error:

Preprocessing executable 'MyProject-exe' for MyProject-0.1.0.0..
Building executable 'MyProject-exe' for MyProject-0.1.0.0..
<command line>: Could not find module `Language.Java.Inline.Plugin'
Use -v (or `:set -v` in ghci) to see a list of the files searched for.

--  While building package MyProject-0.1.0.0 (scroll up to its section to see the error) using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.2.1.0_ghc-8.10.7.exe --builddir=.stack-work\dist\274b403a build lib:MyProject exe:MyProject-exe --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

What am I doing wrong?

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

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

发布评论

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

评论(1

花桑 2025-01-19 12:23:07

您可能需要将 inline-java 添加到 package.yaml 中的可执行依赖项或 MyProject.cabal 中相应的 build-depends` 中。 docs.haskellstack.org/en/stable/... 解释了为什么你需要两者。

You may need to add inline-java to the executable dependencies in your package.yaml or the corresponding build-depends` in your MyProject.cabal. docs.haskellstack.org/en/stable/… explains why you need both.

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