From d1e78d96b6ad9a4afe4b319f9c06668e0aa4ca1c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 10 Jun 2017 16:05:56 +0200 Subject: UTF8: export fromText, fromTextLazy. --- src/Text/Pandoc/UTF8.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/UTF8.hs') diff --git a/src/Text/Pandoc/UTF8.hs b/src/Text/Pandoc/UTF8.hs index 3f1b28e54..663f30d92 100644 --- a/src/Text/Pandoc/UTF8.hs +++ b/src/Text/Pandoc/UTF8.hs @@ -44,7 +44,9 @@ module Text.Pandoc.UTF8 ( readFile , toString , toText , fromString + , fromText , toStringLazy + , fromTextLazy , toTextLazy , fromStringLazy , encodePath @@ -143,11 +145,17 @@ toTextLazy = TL.decodeUtf8 . filterCRs . dropBOM toStringLazy :: BL.ByteString -> String toStringLazy = TL.unpack . toTextLazy +fromText :: T.Text -> B.ByteString +fromText = T.encodeUtf8 + +fromTextLazy :: TL.Text -> BL.ByteString +fromTextLazy = TL.encodeUtf8 + fromString :: String -> B.ByteString -fromString = T.encodeUtf8 . T.pack +fromString = fromText . T.pack fromStringLazy :: String -> BL.ByteString -fromStringLazy = TL.encodeUtf8 . TL.pack +fromStringLazy = fromTextLazy . TL.pack encodePath :: FilePath -> FilePath encodePath = id -- cgit v1.2.3