summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Sources.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2022-10-18 22:10:14 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2022-10-18 22:10:16 -0700
commitbe2f946e8fc8fb515aca5970cf80c189adbfcf89 (patch)
treeb29ed7da8c150f8732bd28c94eaa217caf7a119d /src/Text/Pandoc/Sources.hs
parentbc91e4a8efd99259b49f94c7e2d26294da7eb6d9 (diff)
T.P.Sources: UpdateSourcePos instances for String and...
strict and lazy ByteString. [API change]
Diffstat (limited to 'src/Text/Pandoc/Sources.hs')
-rw-r--r--src/Text/Pandoc/Sources.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Sources.hs b/src/Text/Pandoc/Sources.hs
index f17e566c9..69dc42812 100644
--- a/src/Text/Pandoc/Sources.hs
+++ b/src/Text/Pandoc/Sources.hs
@@ -46,6 +46,8 @@ import Text.Parsec (Stream(..), ParsecT)
import Text.Parsec.Pos as P
import Data.Text (Text)
import qualified Data.Text as T
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Lazy as BL
import Data.Char (isSpace, isLetter, isAlphaNum, isDigit, isHexDigit)
import Data.String (IsString(..))
import qualified Data.List.NonEmpty as NonEmpty
@@ -112,6 +114,15 @@ class UpdateSourcePos s c where
instance UpdateSourcePos Text Char where
updateSourcePos pos c _ = updatePosChar pos c
+instance UpdateSourcePos [Char] Char where
+ updateSourcePos pos c _ = updatePosChar pos c
+
+instance UpdateSourcePos BS.ByteString Char where
+ updateSourcePos pos c _ = updatePosChar pos c
+
+instance UpdateSourcePos BL.ByteString Char where
+ updateSourcePos pos c _ = updatePosChar pos c
+
instance UpdateSourcePos Sources Char where
updateSourcePos pos c sources =
case sources of