如何使用 -v 查看在 Haskell 堆栈中搜索的文件列表
How to use -v to see a list of the files searched for in Haskell Stack
我下面有一些 Haskell 代码。
-- | Determine the prime factors of a given positive integer.
module P36 where
import Data.List
import Data.Numbers (primeFactors)
prime_factors_mult :: Integer -> [(Integer, Int)]
prime_factors_mult = map encode . group . primeFactors
where encode xs = (head xs, length xs)
我在ghci中运行它,它给了我输出:
Prelude> :l P36
[1 of 1] Compiling P36 ( P36.hs, interpreted )
P36.hs:5:1: error:
Failed to load interface for ‘Data.Numbers’
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
我知道这是因为我没有安装 Data.Numbers
。我已经通过 运行ning stack install Numbers
.
解决了
但我不明白 使用 -v 查看搜索的文件列表。 是什么意思。
我 Google 很多,我尝试过使用 :l P36 -v
和 stack -v
。但是 none 被处决的人是正确的。
我的问题是如何使用-v查看搜索的文件列表。
----- 更新 ------
在控制台运行ning ghc -v
后,显示
C:\Users\Administrator>ghc -v
Glasgow Haskell Compiler, Version 8.6.3, stage 2 booted by GHC version 8.4.3
Using binary package database: C:\Users\Administrator\AppData\Local\Programs\sta
ck\x86_64-windows\ghc-8.6.3\lib\package.conf.d\package.cache
package flags []
loading package database C:\Users\Administrator\AppData\Local\Programs\stack\x86
_64-windows\ghc-8.6.3\lib\package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.3
wired-in package integer-gmp mapped to integer-gmp-1.0.2.0
wired-in package base mapped to base-4.12.0.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.14.0.0
wired-in package ghc mapped to ghc-8.6.3
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting:
ghc: no input files
Usage: For basic information, try the `--help' option.
但我看到了 post 错误:“无法为 'Data.Either.Utils' 加载界面”
得到 运行 -v 的结果。这是
Using a sandbox located at
/Users/myuser/Desktop/mydirectory/myotherdirectory/.cabal-sandbox
/usr/local/bin/ghc --print-global-package-db
/usr/local/bin/runghc filename.hs
我检查了路径 C:\Users\Administrator\AppData\Local\Programs\stack\x86
_64-windows\ghc-8.6.3\lib\package.conf.d
,发现它有很多 .conf
个文件。
C:.
array-0.5.3.0.conf
base-4.12.0.0.conf
binary-0.8.6.0.conf
bytestring-0.10.8.2.conf
Cabal-2.4.0.1.conf
containers-0.6.0.1.conf
deepseq-1.4.4.0.conf
directory-1.3.3.0.conf
.....
这些是Haskell搜索的文件吗?
我的 ghc -v
输出合理吗?
看起来你正试图从序曲中调用它。它实际上是编译器本身的一个命令,所以如果你打开你的 terminal/console 尝试 运行 ghc -v
。 (我假设您在标记问题时使用的是 GHC haskell-stack。)
假设您使用 stack ghci
启动 GHCi,您可以使用 stack ghci --ghc-options -v
传递 -v
选项。
Stack 向 GHC 传递一个文件夹列表,stack 在其中安装软件包,因此 GHC 应该在其中查找 Haskell 模块。因此,要从 GHC 获得有用的输出,通常需要通过 stack
调用它,如上所述。 cabal
和其他构建工具的情况类似。
我下面有一些 Haskell 代码。
-- | Determine the prime factors of a given positive integer.
module P36 where
import Data.List
import Data.Numbers (primeFactors)
prime_factors_mult :: Integer -> [(Integer, Int)]
prime_factors_mult = map encode . group . primeFactors
where encode xs = (head xs, length xs)
我在ghci中运行它,它给了我输出:
Prelude> :l P36
[1 of 1] Compiling P36 ( P36.hs, interpreted )
P36.hs:5:1: error:
Failed to load interface for ‘Data.Numbers’
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
我知道这是因为我没有安装 Data.Numbers
。我已经通过 运行ning stack install Numbers
.
但我不明白 使用 -v 查看搜索的文件列表。 是什么意思。
我 Google 很多,我尝试过使用 :l P36 -v
和 stack -v
。但是 none 被处决的人是正确的。
我的问题是如何使用-v查看搜索的文件列表。
----- 更新 ------
在控制台运行ning ghc -v
后,显示
C:\Users\Administrator>ghc -v
Glasgow Haskell Compiler, Version 8.6.3, stage 2 booted by GHC version 8.4.3
Using binary package database: C:\Users\Administrator\AppData\Local\Programs\sta
ck\x86_64-windows\ghc-8.6.3\lib\package.conf.d\package.cache
package flags []
loading package database C:\Users\Administrator\AppData\Local\Programs\stack\x86
_64-windows\ghc-8.6.3\lib\package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.5.3
wired-in package integer-gmp mapped to integer-gmp-1.0.2.0
wired-in package base mapped to base-4.12.0.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.14.0.0
wired-in package ghc mapped to ghc-8.6.3
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting:
ghc: no input files
Usage: For basic information, try the `--help' option.
但我看到了 post 错误:“无法为 'Data.Either.Utils' 加载界面” 得到 运行 -v 的结果。这是
Using a sandbox located at
/Users/myuser/Desktop/mydirectory/myotherdirectory/.cabal-sandbox
/usr/local/bin/ghc --print-global-package-db
/usr/local/bin/runghc filename.hs
我检查了路径 C:\Users\Administrator\AppData\Local\Programs\stack\x86
_64-windows\ghc-8.6.3\lib\package.conf.d
,发现它有很多 .conf
个文件。
C:.
array-0.5.3.0.conf
base-4.12.0.0.conf
binary-0.8.6.0.conf
bytestring-0.10.8.2.conf
Cabal-2.4.0.1.conf
containers-0.6.0.1.conf
deepseq-1.4.4.0.conf
directory-1.3.3.0.conf
.....
这些是Haskell搜索的文件吗?
我的 ghc -v
输出合理吗?
看起来你正试图从序曲中调用它。它实际上是编译器本身的一个命令,所以如果你打开你的 terminal/console 尝试 运行 ghc -v
。 (我假设您在标记问题时使用的是 GHC haskell-stack。)
假设您使用 stack ghci
启动 GHCi,您可以使用 stack ghci --ghc-options -v
传递 -v
选项。
Stack 向 GHC 传递一个文件夹列表,stack 在其中安装软件包,因此 GHC 应该在其中查找 Haskell 模块。因此,要从 GHC 获得有用的输出,通常需要通过 stack
调用它,如上所述。 cabal
和其他构建工具的情况类似。