为什么 GHC 找不到模块“Language.Java.Inline.Plugin”?
我正在尝试使用
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要将 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.