summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-12-03 22:35:58 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-01-25 17:07:40 +0100
commitd7583f365951373158a55ce344ba6b345ea481ec (patch)
treed8c1d4c0b0b734f4ba6309ba2428a9eec4fb4284 /src/Text/Pandoc.hs
parent1a0d93a1d33b6b15be15690df9f8aa305cf965b3 (diff)
Error: change type of handleError.
It now lives in IO and gives a proper message + exit instead of calling 'error'. We shouldn't be making it easier for people to raise error on pure code. And this is better for the main application in IO.
Diffstat (limited to 'src/Text/Pandoc.hs')
-rw-r--r--src/Text/Pandoc.hs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
index 320af805a..4990a77fe 100644
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -38,12 +38,11 @@ inline links:
> module Main where
> import Text.Pandoc
>
-> markdownToRST :: String -> String
+> markdownToRST :: String -> Either PandocError String
> markdownToRST =
-> writeRST def {writerReferenceLinks = True} .
-> handleError . readMarkdown def
+> writeRST def {writerReferenceLinks = True} . readMarkdown def
>
-> main = getContents >>= putStrLn . markdownToRST
+> main = getContents >>= either error return markdownToRST >>= putStrLn
Note: all of the readers assume that the input text has @'\n'@
line endings. So if you get your input text from a web form,