diff options
-rw-r--r-- | pandoc.cabal | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Pretty.hs | 13 |
2 files changed, 7 insertions, 8 deletions
diff --git a/pandoc.cabal b/pandoc.cabal index 95b6760ac..3ed7059aa 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -212,7 +212,6 @@ Library citeproc-hs >= 0.3.4 && < 0.4, pandoc-types == 1.9.*, json >= 0.4 && < 0.6, - dlist >= 0.4 && < 0.6, tagsoup >= 0.12.5 && < 0.13, base64-bytestring >= 0.1 && < 0.2, zlib >= 0.5 && <= 0.6, @@ -307,7 +306,6 @@ Executable pandoc citeproc-hs >= 0.3.4 && < 0.4, pandoc-types == 1.9.*, json >= 0.4 && < 0.6, - dlist >= 0.4 && < 0.6, tagsoup >= 0.12.5 && < 0.13, base64-bytestring >= 0.1 && < 0.2, zlib >= 0.5 && <= 0.6, diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs index b06f2f384..340afeeed 100644 --- a/src/Text/Pandoc/Pretty.hs +++ b/src/Text/Pandoc/Pretty.hs @@ -72,7 +72,8 @@ module Text.Pandoc.Pretty ( ) where -import Data.DList (DList, fromList, toList, cons, singleton) +import Data.Sequence (Seq, fromList, (<|), singleton) +import Data.Foldable (toList) import Data.List (intercalate) import Data.Monoid import Data.String @@ -102,7 +103,7 @@ data D = Text Int String | BlankLine deriving (Show) -newtype Doc = Doc { unDoc :: DList D } +newtype Doc = Doc { unDoc :: Seq D } deriving (Monoid) instance Show Doc where @@ -342,12 +343,12 @@ offsetOf _ = 0 -- | A literal string. text :: String -> Doc text = Doc . toChunks - where toChunks :: String -> DList D + where toChunks :: String -> Seq D toChunks [] = mempty toChunks s = case break (=='\n') s of - ([], _:ys) -> NewLine `cons` toChunks ys - (xs, _:ys) -> Text (realLength xs) xs `cons` - NewLine `cons` toChunks ys + ([], _:ys) -> NewLine <| toChunks ys + (xs, _:ys) -> Text (realLength xs) xs <| + (NewLine <| toChunks ys) (xs, []) -> singleton $ Text (realLength xs) xs -- | A character. |