Created
September 26, 2020 05:31
-
-
Save aerohit/5de8b831eb59eeba329fc0615dac15a6 to your computer and use it in GitHub Desktop.
Convert between String Text And ByteString
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Reference: Ecky Putrady, Practical Web Development with Haskell, Table 2-1 | |
String Text fromString | |
String LText fromString | |
String ByteString fromString | |
String LByteString fromString | |
Text LText fromStrict | |
Text ByteString encodeUtf8 | |
Text LByteString (fromStrict . encodeUtf8) | |
Text String unpack | |
LText Text toStrict | |
LText ByteString (toStrict . encodeUtf8) | |
LText LByteString encodeUtf8 | |
LText String unpack | |
ByteString LByteString fromStrict | |
ByteString Text decodeUtf8 | |
ByteString LText (fromStrict . decodeUtf8) | |
ByteString String (unpack . decodeUtf8) | |
LByteString ByteString toStrict | |
LByteString Text (toStrict . decodeUtf8) | |
LByteString LText decodeUtf8 | |
LByteString String (unpack . decodeUtf8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment