I am trying:
import System.IO
saveArr = do
outh <- openFile "test.txt" WriteMode
hPutStrLn outh [1,2,3]
hClose outh
but it doesn't works... output:
No instance for (Num Char) arising from the literal `1'
EDIT
OK hPrint
works with ints but what about float number in array? [1.0, 2.0, 3.0]
?
hPutStrLn
can only print strings. Perhaps you want hPrint
?
hPrint outh [1,2,3]
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