aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-02-05 14:25:12 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-02-05 14:25:12 -0800
commit4dec972cfe6827f4c7a40cf1c50e4a0120d4e442 (patch)
treec5fc03e0fa17237cf91a4b3c7619b6fe496c1cd8 /src/Text/Pandoc
parenteed87d77553864066bcb545645df8e999d64fbeb (diff)
downloadpandoc-4dec972cfe6827f4c7a40cf1c50e4a0120d4e442.tar.gz
Remove dependency on dlist.
Use sequence in Pretty instead.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Pretty.hs13
1 files changed, 7 insertions, 6 deletions
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.