Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make benchmarks compile with modern criterion #4

Closed
wants to merge 1 commit into from
Closed

Make benchmarks compile with modern criterion #4

wants to merge 1 commit into from

Conversation

RyanGlScott
Copy link

Currently, the benchmarks fail to build:

Preprocessing library xmlgen-0.6.2.1...
[1 of 1] Compiling Text.XML.Generator ( src/Text/XML/Generator.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/Text/XML/Generator.o )
In-place registering xmlgen-0.6.2.1...
Preprocessing benchmark 'xmlgen-bench' for xmlgen-0.6.2.1...
[1 of 1] Compiling Main             ( test/GeneratorBenchmarks.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/xmlgen-bench/xmlgen-bench-tmp/Main.o )

/nfs/home/crest-team/jenkins_workspaces/cutter/workspace/benchmark_stackage/label/CREST_cutter/.bench-build/lts-5.16/xmlgen-0.6.2.1/test/GeneratorBenchmarks.hs:10:25:
    Couldn't match type ‘[Char]’ with ‘T.Text’
    Expected type: Name
      Actual type: [Char]
    In the first argument of ‘xelem’, namely ‘"root"’
    In the expression: xelem "root"
    In the expression:
      xelem "root"
      $ xelems
        $ map
            (\ s -> xelem "foo" (xattr "key" s, xtext s))
            (map (\ i -> T.pack (show i)) [1 .. numberOfElems])

/nfs/home/crest-team/jenkins_workspaces/cutter/workspace/benchmark_stackage/label/CREST_cutter/.bench-build/lts-5.16/xmlgen-0.6.2.1/test/GeneratorBenchmarks.hs:10:60:
    Couldn't match type ‘[Char]’ with ‘T.Text’
    Expected type: Name
      Actual type: [Char]
    In the first argument of ‘xelem’, namely ‘"foo"’
    In the expression: xelem "foo" (xattr "key" s, xtext s)
    In the first argument of ‘map’, namely
      ‘(\ s -> xelem "foo" (xattr "key" s, xtext s))’

/nfs/home/crest-team/jenkins_workspaces/cutter/workspace/benchmark_stackage/label/CREST_cutter/.bench-build/lts-5.16/xmlgen-0.6.2.1/test/GeneratorBenchmarks.hs:10:73:
    Couldn't match type ‘[Char]’ with ‘T.Text’
    Expected type: Name
      Actual type: [Char]
    In the first argument of ‘xattr’, namely ‘"key"’
    In the expression: xattr "key" s
    In the second argument of ‘xelem’, namely
      ‘(xattr "key" s, xtext s)’
/nfs/home/crest-team/jenkins_workspaces/cutter/workspace/benchmark_stackage/label/CREST_cutter/.bench-build/lts-5.16/xmlgen-0.6.2.1/test/GeneratorBenchmarks.hs:14:25:
    Couldn't match type ‘[Char]’ with ‘T.Text’
    Expected type: Name
      Actual type: [Char]
    In the first argument of ‘xelem’, namely ‘"root"’
    In the expression: xelem "root"
    In the expression:
      xelem "root"
      $ xattrs
        $ map
            (\ s -> xattr ("key-" ++ s) (T.pack s))
            (map (\ i -> show i) [1 .. numberOfElems])

/nfs/home/crest-team/jenkins_workspaces/cutter/workspace/benchmark_stackage/label/CREST_cutter/.bench-build/lts-5.16/xmlgen-0.6.2.1/test/GeneratorBenchmarks.hs:14:61:
    Couldn't match type ‘[Char]’ with ‘T.Text’
    Expected type: Name
      Actual type: [Char]
    In the first argument of ‘xattr’, namely ‘("key-" ++ s)’
    In the expression: xattr ("key-" ++ s) (T.pack s)
    In the first argument of ‘map’, namely
      ‘(\ s -> xattr ("key-" ++ s) (T.pack s))’

/nfs/home/crest-team/jenkins_workspaces/cutter/workspace/benchmark_stackage/label/CREST_cutter/.bench-build/lts-5.16/xmlgen-0.6.2.1/test/GeneratorBenchmarks.hs:21:74:
    Couldn't match expected type ‘Benchmarkable’
                with actual type ‘IO ()’
    In the second argument of ‘bench’, namely ‘(benchElems i)’
    In the expression: bench (show i ++ " elems") (benchElems i)

/nfs/home/crest-team/jenkins_workspaces/cutter/workspace/benchmark_stackage/label/CREST_cutter/.bench-build/lts-5.16/xmlgen-0.6.2.1/test/GeneratorBenchmarks.hs:22:74:
    Couldn't match expected type ‘Benchmarkable’
                with actual type ‘IO ()’
    In the second argument of ‘bench’, namely ‘(benchAttrs i)’
    In the expression: bench (show i ++ " attrs") (benchAttrs i)

I made some small tweaks to get things working again:

  • Use whnfIO from criterion >= 1
  • Account for the existence of Text in more places

See also iu-parfunc/sc-haskell#7

@RyanGlScott
Copy link
Author

Closing stale PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant