summaryrefslogtreecommitdiff
path: root/benchmark/benchmark-pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-03-28 12:12:48 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-03-28 12:12:48 -0700
commit6a3a04c4280817df39519bf1d73eee3b9e0b3841 (patch)
tree304a696d66d3d8cfb6f1441086947c12f2cb1cb8 /benchmark/benchmark-pandoc.hs
parentd744b83b61bc635419339b73b687b9280ee757fc (diff)
parentad39bc7009e320b3afb91a5683521eb1eccf0ef7 (diff)
Merge branch 'errortype' of https://github.com/mpickering/pandoc into mpickering-errortype
Conflicts: benchmark/benchmark-pandoc.hs src/Text/Pandoc/Readers/Markdown.hs src/Text/Pandoc/Readers/Org.hs src/Text/Pandoc/Readers/RST.hs tests/Tests/Readers/LaTeX.hs
Diffstat (limited to 'benchmark/benchmark-pandoc.hs')
-rw-r--r--benchmark/benchmark-pandoc.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs
index 2a34696b9..5c0dab460 100644
--- a/benchmark/benchmark-pandoc.hs
+++ b/benchmark/benchmark-pandoc.hs
@@ -22,20 +22,22 @@ 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
_ | name == "commonmark" ->
let inp = writeMarkdown def{ writerWrapText = True} doc
in return $ bench (name ++ " reader") $ nfIO $
- (reader def{ readerSmart = True }) inp
+ (fmap handleError <$> reader def{ readerSmart = True }) inp
| otherwise -> trace ("\nCould not find writer for " ++ name ++
"\n") Nothing
@@ -52,7 +54,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'