diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-08-22 17:47:18 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-08-24 22:19:15 -0700 |
commit | c39ddeb8f86e9dec5bd6096685812452e3f2c65e (patch) | |
tree | 7c9425531bcf7b60a9f1c8b9ef789ca3261ba91f /src/Text/Pandoc/Class/IO.hs | |
parent | 8ad22002cb5ac4c79acda84c7256c6a122e2dd93 (diff) | |
download | pandoc-c39ddeb8f86e9dec5bd6096685812452e3f2c65e.tar.gz |
Text.Pandoc.Class: add readStdinStrict method to PandocMonad.
[API change]
Diffstat (limited to 'src/Text/Pandoc/Class/IO.hs')
-rw-r--r-- | src/Text/Pandoc/Class/IO.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Class/IO.hs b/src/Text/Pandoc/Class/IO.hs index f4cfc8682..305f07a01 100644 --- a/src/Text/Pandoc/Class/IO.hs +++ b/src/Text/Pandoc/Class/IO.hs @@ -30,6 +30,7 @@ module Text.Pandoc.Class.IO , openURL , readFileLazy , readFileStrict + , readStdinStrict , extractMedia ) where @@ -158,6 +159,11 @@ readFileLazy s = liftIOError BL.readFile s readFileStrict :: (PandocMonad m, MonadIO m) => FilePath -> m B.ByteString readFileStrict s = liftIOError B.readFile s +-- | Read the strict ByteString contents from stdin, raising +-- an error on failure. +readStdinStrict :: (PandocMonad m, MonadIO m) => m B.ByteString +readStdinStrict = liftIOError (const B.getContents) "stdin" + -- | Return a list of paths that match a glob, relative to the working -- directory. See 'System.FilePath.Glob' for the glob syntax. glob :: (PandocMonad m, MonadIO m) => String -> m [FilePath] |