diff options
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 5b88a7948..90789447f 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -6,6 +6,8 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ViewPatterns #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeSynonymInstances #-} {- Copyright (C) 2006-2018 John MacFarlane <jgm@berkeley.edu> @@ -43,6 +45,7 @@ module Text.Pandoc.Shared ( substitute, ordNub, -- * Text processing + ToString (..), backslashEscapes, escapeStringUsing, stripTrailingNewlines, @@ -193,6 +196,15 @@ ordNub l = go Set.empty l -- Text processing -- +class ToString a where + toString :: a -> String + +instance ToString String where + toString = id + +instance ToString T.Text where + toString = T.unpack + -- | Returns an association list of backslash escapes for the -- designated characters. backslashEscapes :: [Char] -- ^ list of special characters to escape |