@@ -44,7 +44,9 @@ module Text.Pandoc.UTF8 ( readFile
4444 , toString
4545 , toText
4646 , fromString
47+ , fromText
4748 , toStringLazy
49+ , fromTextLazy
4850 , toTextLazy
4951 , fromStringLazy
5052 , encodePath
@@ -143,11 +145,17 @@ toTextLazy = TL.decodeUtf8 . filterCRs . dropBOM
143145toStringLazy :: BL.ByteString -> String
144146toStringLazy = TL.unpack . toTextLazy
145147
148+fromText :: T.Text -> B.ByteString
149+fromText = T.encodeUtf8
150+
151+fromTextLazy :: TL.Text -> BL.ByteString
152+fromTextLazy = TL.encodeUtf8
153+
146154fromString :: String -> B.ByteString
147−fromString = T.encodeUtf8 . T.pack
155+fromString = fromText . T.pack
148156
149157fromStringLazy :: String -> BL.ByteString
150−fromStringLazy = TL.encodeUtf8 . TL.pack
158+fromStringLazy = fromTextLazy . TL.pack
151159
152160encodePath :: FilePath -> FilePath
153161encodePath = id