import Main.Utf8 (withUtf8)
main :: IO ()
main = withUtf8 $ do
putStrLn "Hello, мир!"
Basically, this is all you have to do for a program that uses
stdin and stdout to interact with the user. However, some
programs read input from and write output to files and,
at the same time, allow the user to redirect stdin and stdout
instead of providing explicit file names.
If this is the case for your executable, you should also wrap
Utf8.withHandle around the code that passes
the handle to a third-party library. It is not necessary to do
when passing it to your own library, assuming that it follows
the recommendations from the documentation of System.IO.Utf8.