Hey!
I am starting my little project with simple copy stdin to stdout code like this:
module Main where
import System.IO
import Lib
main :: IO ()
main = do
iseof <- hIsEOF stdin
if iseof
then return ()
else do
line <- getLine
putStrLn line
main
Reading input with invalid (probably UTF) character I am getting (unsurprisingly) this:
<stdin>: hGetLine: invalid argument (invalid byte sequence)
I do want to support malformed chars on input. I want to skip such chars and continue processing.
Can somebody please point me in the right direction how to do it? I am comfortable with FP but not very knowledgeable about Haskell libraries and apis…
thanks!