To be able to read and write to a file with functions such as vGetContents and vPutStrLn I think it is mandatory to define some of
- withEncoding utf8
I am sure the first one is needed, I thought the other two wasn't but then I had trouble without them. The trouble is shown as a ugly message and abortion of the program at run-time:
*** Exception: illegal operation
I had to even add those layers to standard input and standard output, without them it was impossible to print and read. I ended up with something like:
inStream <- bufferBlockStream fdStdIn >>= withEncoding utf8 >>= withLocking outStream <- bufferBlockStream fdStdOut >>= withEncoding utf8 >>= withLocking
Maybe this can be improved somehow in the library, but otherwise I believe it should be documented.