git.iko.soy/typeable/pandoc
on master help sign in
Fixed weigh-pandoc for Text readers.
commit25bfa26554a0236ce21cef036609651cdcbc44aa authorJohn MacFarlane <jgm@berkeley.edu> dateSat 10 Jun 2017, 21:10 (9 years ago) parentf43504f
3 files changed+8−3
Makefile+4−1 benchmark/weigh-pandoc.hs+3−2 pandoc.cabal+1
Makefile+4−1
@@ -18,6 +18,9 @@ test:
1818bench:
1919 stack bench
2020
21+weigh:
22+ stack build --flag 'pandoc:weigh-pandoc' && stack exec weigh-pandoc
23+
2124reformat:
2225 for f in $(sourcefiles); do echo $$f; stylish-haskell -i $$f ; done
2326
@@ -62,4 +65,4 @@ download_stats:
6265clean:
6366 stack clean
6467
65−.PHONY: deps quick full install clean test bench changes_github macospkg dist prof download_stats reformat lint
68+.PHONY: deps quick full install clean test bench changes_github macospkg dist prof download_stats reformat lint weigh
benchmark/weigh-pandoc.hs+3−2
@@ -1,5 +1,6 @@
11import Weigh
22import Text.Pandoc
3+import Data.Text (Text, pack)
34
45main :: IO ()
56main = do
@@ -26,11 +27,11 @@ main = do
2627weighWriter :: Pandoc -> String -> (Pandoc -> String) -> Weigh ()
2728weighWriter doc name writer = func (name ++ " writer") writer doc
2829
29−weighReader :: Pandoc -> String -> (String -> Pandoc) -> Weigh ()
30+weighReader :: Pandoc -> String -> (Text -> Pandoc) -> Weigh ()
3031weighReader doc name reader = do
3132 case lookup name writers of
3233 Just (StringWriter writer) ->
33− let inp = either (error . show) id $ runPure $ writer def{ writerWrapText = WrapAuto} doc
34+ let inp = either (error . show) pack $ runPure $ writer def{ writerWrapText = WrapAuto} doc
3435 in func (name ++ " reader") reader inp
3536 _ -> return () -- no writer for reader
3637
pandoc.cabal+1
@@ -507,6 +507,7 @@ Executable weigh-pandoc
507507 if flag(weigh-pandoc)
508508 Build-Depends: pandoc,
509509 base >= 4.2 && < 5,
510+ text,
510511 weigh >= 0.0 && < 0.1,
511512 mtl >= 2.2 && < 2.3
512513 Buildable: True