Haskell软件包已安装但未找到 [英] Haskell package installed but not found
问题描述
我安装了图表,似乎在那里,但GHCi没有找到它。我尝试添加本地沙箱到命令行(-package-db),但仍然没有运气。
有何建议?
C:\ Users \ guthrie>
C:\Users\guthrie> cabal安装图
解决依赖关系...
所有请求的软件包已经安装:
图-1.2
使用 - - 如果您想重新安装,请重新安装。
我在下面找到它:
<$ p $ C $ \\ b $ b $(图-1.2,图表-c,c:\ Users \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' contrib,-core,-lib,-svg)
但运行:cabal repl或使用GHC(i)标记 -package-db = ...
未能找到它:
C:\ Users \ guthrie> cabal repl
GHCi,版本7.6.3:http://www.haskell.org/ghc/:?寻求帮助
加载包ghc-prim ...链接...完成。
加载包integer-gmp ...链接...完成。
加载程序包库...链接...完成。
前奏> :m + Diagrams.Prelude
< no location info>:
找不到模块`Diagrams.Prelude'
它不是当前程序中的模块,也不是任何已知的包装。
前奏>
澄清;忽略cabal调用,直接使用GHC / i,以及程序diagramDemo.hs:
- http:// projects。 haskell.org/diagrams/doc/quickstart.html
-
import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine
main = mainWith(circle 1 ::图B R2)
给出:
C:\Users\guthrie\Desktop\xFer\Graphics> ghc - 生成图表Demo.hs
diagramsDemo.hs:7 :8:
找不到模块`Diagrams.Backend.SVG.CmdLine'
使用-v查看搜索文件的列表。
C:\Users\guthrie\Desktop\xFer\Graphics> ghc - 生成图表Demo.hs -package-db = C:\ Users \\\\\\\\\\\\\\ -sandbox \i386-windows-ghc-7.6.3-packages.conf.d
diagramsDemo.hs:7:8:
找不到模块`Diagrams.Backend.SVG。 CmdLine'
使用-v查看搜索的文件列表。
正如bheklilr所说,如果 然而你可以用 I installed diagrams, and it seems to be there, but GHCi doesn’t find it. I tried adding the local sandbox to the command line (-package-db), but still no luck.
Any suggestions? I find it in: But running: "cabal repl" or using the GHC(i) flag "-package-db=…"
fail to find it:
To clarify; ignoring the cabal invocations, using GHC/i directly, and the program diagramsDemo.hs: Gives:
As bheklilr said, if However you can start it with The same is true for invoking 这篇关于Haskell软件包已安装但未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! ghci
以 cabal repl
开头,它只能在 .cabal $ c中查找指定为依赖项的包$ c $ file>。
cabal exec ghci
来启动它,然后它会找到所有安装的软件包在调用 ghc
( cabal build )时也是如此。 code> vs
cabal exec ghc
),但是请注意,如果你想传递标志,你必须使用 -
,如 cabal exec ghc - -O2 Main.hs
。或者,您可以使用 cabal exec bash
并启动 ghci
或 ghc
在新shell中。
cabal exec
添加了Cabal 1.20。 C:\Users\guthrie>
C:\Users\guthrie>cabal install diagrams
Resolving dependencies...
All the requested packages are already installed:
diagrams-1.2
Use --reinstall if you want to reinstall anyway.
C:\Users\guthrie\.cabal-sandbox\i386-windows-ghc-7.6.3-packages.conf.d
(diagrams-1.2, diagrams-contrib, -core, -lib, -svg)
C:\Users\guthrie>cabal repl
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :m + Diagrams.Prelude
<no location info>:
Could not find module `Diagrams.Prelude'
It is not a module in the current program, or in any known package.
Prelude>
-- http://projects.haskell.org/diagrams/doc/quickstart.html
--
import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine
main = mainWith (circle 1 :: Diagram B R2)
C:\Users\guthrie\Desktop\xFer\Graphics>ghc --make diagramsDemo.hs
diagramsDemo.hs:7:8:
Could not find module `Diagrams.Backend.SVG.CmdLine'
Use -v to see a list of the files searched for.
C:\Users\guthrie\Desktop\xFer\Graphics>ghc --make diagramsDemo.hs -package-db=C:\Users\guthrie\.cabal-sandbox\i386-windows-ghc-7.6.3-packages.conf.d
diagramsDemo.hs:7:8:
Could not find module `Diagrams.Backend.SVG.CmdLine'
Use -v to see a list of the files searched for.
ghci
is started with cabal repl
, it will only find packages specified as a dependency in the .cabal
file.cabal exec ghci
, then it will find all packages installed in the sandbox.ghc
(cabal build
vs. cabal exec ghc
), but note that if you want to pass flags you have to use --
, like in cabal exec ghc -- -O2 Main.hs
. Alternatively you can use cabal exec bash
and launch ghci
or ghc
in the new shell.cabal exec
was added with Cabal 1.20.