summaryrefslogtreecommitdiff
path: root/benchmark/benchmark-pandoc.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2015-02-18 20:10:12 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2015-02-18 21:09:07 +0000
commitf046531a6b260b9c1c6b5222d5ef7aecbd91238c (patch)
treec4222f70a748cad9a4f2205861dce292007f03d8 /benchmark/benchmark-pandoc.hs
parent1a7a99161a6a41d8eba7ce02482eeaf0b0ba75d5 (diff)
Update benchmarks
Diffstat (limited to 'benchmark/benchmark-pandoc.hs')
-rw-r--r--benchmark/benchmark-pandoc.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs
index bf67eaa4d..61e838cbc 100644
--- a/benchmark/benchmark-pandoc.hs
+++ b/benchmark/benchmark-pandoc.hs
@@ -22,15 +22,17 @@ import System.Environment (getArgs)
import Data.Monoid
import Data.Maybe (mapMaybe)
import Debug.Trace (trace)
+import Text.Pandoc.Error
+import Control.Applicative
readerBench :: Pandoc
- -> (String, ReaderOptions -> String -> IO Pandoc)
+ -> (String, ReaderOptions -> String -> IO (Either PandocError Pandoc))
-> Maybe Benchmark
readerBench doc (name, reader) = case lookup name writers of
Just (PureStringWriter writer) ->
let inp = writer def{ writerWrapText = True} doc
in return $ bench (name ++ " reader") $ nfIO $
- (reader def{ readerSmart = True }) inp
+ (fmap handleError <$> reader def{ readerSmart = True }) inp
_ -> trace ("\nCould not find writer for " ++ name ++ "\n") Nothing
writerBench :: Pandoc
@@ -46,7 +48,7 @@ main = do
defaultOptions args
inp <- readFile "tests/testsuite.txt"
let opts = def{ readerSmart = True }
- let doc = readMarkdown opts inp
+ let doc = handleError $ readMarkdown opts inp
let readers' = [(n,r) | (n, StringReader r) <- readers]
let readerBs = mapMaybe (readerBench doc)
$ filter (\(n,_) -> n /="haddock") readers'