Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell 如何在堆栈中使用criteria_Haskell_Cabal_Haskell Stack_Criterion - Fatal编程技术网

Haskell 如何在堆栈中使用criteria

Haskell 如何在堆栈中使用criteria,haskell,cabal,haskell-stack,criterion,Haskell,Cabal,Haskell Stack,Criterion,我为基准测试设置了一个简单的堆栈项目和一个.cabal条目: benchmark leaves-of-a-tree-bench type: exitcode-stdio-1.0 hs-source-dirs: src, bench main-is: MainBenchmarkSuite.hs build-depends: base , criterion ,

我为基准测试设置了一个简单的堆栈项目和一个.cabal条目:

benchmark leaves-of-a-tree-bench
  type:             exitcode-stdio-1.0
  hs-source-dirs:   src, bench
  main-is:          MainBenchmarkSuite.hs
  build-depends:    base
                  , criterion
                  , random
                  , leaves-of-a-tree
  ghc-options:      -Wall
                    -O2
  default-language: Haskell2010                    
但是,在运行
堆栈工作台
后,我得到以下错误:

setup-Simple-Cabal-1.22.5.0-ghc-7.10.3: Error: Could not find benchmark program      
".stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/leaves-of-a-tree-bench/leaves-of-a-tree-bench".
Did you build the package first?
我错过什么了吗


编辑:我将项目上传到了

这提醒了我当你没有合适的主模块时会发生什么。顶部是否有“模块MainBenchmarkSuite”


我找不到这方面的ghc罚单,但出于某种原因,ghc认为这只是一个警告。IIRC在GHC 8.0中解决了这个问题,这里发生了一些奇怪的阴谋

你的:

现在,一旦我简单地删除该行

module LeavesOfATreeBench where
一切正常:

Registering leaves-of-a-tree-0.1.0.0...
leaves-of-a-tree-0.1.0.0: benchmarks
Running 1 benchmarks...
Benchmark leaves-of-a-tree-bench: RUNNING...
benchmarking leaves/tree 0
time                 41.81 ns   (41.51 ns .. 42.29 ns)
                     0.999 R²   (0.998 R² .. 0.999 R²)
mean                 42.65 ns   (42.12 ns .. 43.50 ns)
std dev              2.293 ns   (1.526 ns .. 3.690 ns)
variance introduced by outliers: 75% (severely inflated)

benchmarking leaves/tree 1
time                 71.11 ns   (70.41 ns .. 71.84 ns)
                     0.999 R²   (0.999 R² .. 0.999 R²)
mean                 71.30 ns   (70.45 ns .. 72.19 ns)
std dev              2.917 ns   (2.431 ns .. 3.507 ns)
variance introduced by outliers: 62% (severely inflated)

Benchmark leaves-of-a-tree-bench: FINISH
Completed 2 action(s).

如果你尝试进行
堆栈构建
?你能在某个地方上传一个有此问题的完整项目吗?(无关:通过在
构建依赖项中定义
leaves-of-a-tree
,并将
src
添加到
hs-source-dirs
中,您两次依赖于库组件),我确实尝试了
堆栈构建
。问题是找不到基准程序@简:谢谢你的评论。我还将相关文件上传到github。我认为包含基准测试程序的模块一切正常。然而,我可能错过了一些东西。我添加了一个指向包含该项目的github存储库的链接。请注意,我在试图寻找解决方案时做了一些重命名。这似乎是阴谋集团或堆栈中的一个bug,不是吗?因为堆栈正在使用阴谋集团库进行大多数构建,我猜这与阴谋集团有关。如果它不被认为是一个bug,至少文档中应该包括这一点。
Registering leaves-of-a-tree-0.1.0.0...
leaves-of-a-tree-0.1.0.0: benchmarks
Running 1 benchmarks...
Benchmark leaves-of-a-tree-bench: RUNNING...
benchmarking leaves/tree 0
time                 41.81 ns   (41.51 ns .. 42.29 ns)
                     0.999 R²   (0.998 R² .. 0.999 R²)
mean                 42.65 ns   (42.12 ns .. 43.50 ns)
std dev              2.293 ns   (1.526 ns .. 3.690 ns)
variance introduced by outliers: 75% (severely inflated)

benchmarking leaves/tree 1
time                 71.11 ns   (70.41 ns .. 71.84 ns)
                     0.999 R²   (0.999 R² .. 0.999 R²)
mean                 71.30 ns   (70.45 ns .. 72.19 ns)
std dev              2.917 ns   (2.431 ns .. 3.507 ns)
variance introduced by outliers: 62% (severely inflated)

Benchmark leaves-of-a-tree-bench: FINISH
Completed 2 action(s).