summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-08-09 08:11:28 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2012-08-09 08:11:28 -0700
commita740de05086960eb6d926f68acd43fedb4599f6c (patch)
treebfdbb5d23d89aa7c431e1c2edf91560454e3358c /src/Text/Pandoc.hs
parent10cdd59fa8664caf5ac73dc06ee7076a4bbe69bd (diff)
Use safeRead instead of using reads directly (various modules).
Diffstat (limited to 'src/Text/Pandoc.hs')
-rw-r--r--src/Text/Pandoc.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
index b65e7130d..6a019bc3f 100644
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -135,6 +135,7 @@ import Text.Pandoc.Writers.Org
import Text.Pandoc.Writers.AsciiDoc
import Text.Pandoc.Templates
import Text.Pandoc.Options
+import Text.Pandoc.Shared (safeRead)
import Data.ByteString.Lazy (ByteString)
import Data.Version (showVersion)
import Text.JSON.Generic
@@ -158,10 +159,9 @@ parseFormatSpec = parse formatSpec ""
extMod = do
polarity <- oneOf "-+"
name <- many1 $ noneOf "-+"
- ext <- case reads name of
- ((n,[]):_) -> return n
- _ -> unexpected $ "Unknown extension: " ++
- name
+ ext <- case safeRead name of
+ Just n -> return n
+ Nothing -> unexpected $ "Unknown extension: " ++ name
return $ case polarity of
'-' -> Set.delete ext
_ -> Set.insert ext