summaryrefslogtreecommitdiff
path: root/benchmark/benchmark-pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-08-08 23:18:19 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-08-08 23:18:19 -0700
commitdfa4b76630837560189844eb79c83abcb619b0f6 (patch)
tree5b7c1f288b16367fcfef56c7b47051098c56da6a /benchmark/benchmark-pandoc.hs
parent34f1f9716b620e3c50b7298abb6a78055d300ae8 (diff)
Changes to literate haskell options.
- Removed writerLiterateHaskell from WriterOptions. - Removed readerLiterateHaskell from ReaderOptions. - Added Ext_literate_haskell to Extensions. Test for this instead of the above. - Removed failUnlessLHS from Shared. Note: At this point, +lhs and .lhs extension no longer has any effect. Need to fix.
Diffstat (limited to 'benchmark/benchmark-pandoc.hs')
-rw-r--r--benchmark/benchmark-pandoc.hs13
1 files changed, 3 insertions, 10 deletions
diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs
index 7dbd29bed..728e45b56 100644
--- a/benchmark/benchmark-pandoc.hs
+++ b/benchmark/benchmark-pandoc.hs
@@ -2,7 +2,6 @@ import Text.Pandoc
import Text.Pandoc.Shared (readDataFile, normalize)
import Criterion.Main
import Criterion.Config
-import Data.List (isSuffixOf)
import Text.JSON.Generic
import System.Environment (getArgs)
import Data.Monoid
@@ -14,24 +13,18 @@ readerBench doc (name, reader) =
let writer = case lookup name writers of
Just (PureStringWriter w) -> w
_ -> error $ "Could not find writer for " ++ name
- inp = writer def{ writerWrapText = True
- , writerLiterateHaskell =
- "+lhs" `isSuffixOf` name } doc
+ inp = writer def{ writerWrapText = True } doc
-- we compute the length to force full evaluation
getLength (Pandoc (Meta a b c) d) =
length a + length b + length c + length d
in bench (name ++ " reader") $ whnf (getLength .
- reader def{ readerSmart = True
- , readerLiterateHaskell = "+lhs" `isSuffixOf` name
- }) inp
+ reader def{ readerSmart = True }) inp
writerBench :: Pandoc
-> (String, WriterOptions -> Pandoc -> String)
-> Benchmark
writerBench doc (name, writer) = bench (name ++ " writer") $ nf
- (writer def{
- writerWrapText = True
- , writerLiterateHaskell = "+lhs" `isSuffixOf` name }) doc
+ (writer def{ writerWrapText = True }) doc
normalizeBench :: Pandoc -> [Benchmark]
normalizeBench doc = [ bench "normalize - with" $ nf (encodeJSON . normalize) doc