main :: IO ()
main = do
let a = ("teeeeeeeeeeeeest","teeeeeeeeeeeest")
b <- app a
print b
app expects (bytestring,bytestring) not ([char],[char]) how can I convert it?
You can convert String
s to ByteString
s with Data.ByteString.Char8.pack
(or the lazy ByteString
version thereof) if your String
contains only ASCII values or you are interested only in the last eight bits of each Char
,
import qualified Data.ByteString.Char8 as C
main :: IO ()
main = do
let a = ("teeeeeeeeeeeeest","teeeeeeeeeeeest")
b <- app $ (\(x,y) -> (C.pack x, C.pack y)) a
print b
If your String
contains non-ASCII Char
s and you are interested in more than only the last eight bits, you will need some other encoding, like Data.ByteString.UTF8.fromString
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With