never executed always true always false
    1 {-# OPTIONS_GHC -Wno-orphans #-}
    2 {-# LANGUAGE TypeFamilies #-}
    3 module CommandLine.World.IO where
    4 
    5 import Prelude ()
    6 import Relude hiding (getLine, putStr)
    7 
    8 import CommandLine.World
    9 import qualified Data.Text as Text
   10 import qualified Data.Text.IO
   11 import qualified Data.ByteString.Lazy as Lazy
   12 import qualified System.Directory
   13 import qualified System.Environment
   14 import qualified System.Exit
   15 import qualified System.IO
   16 
   17 
   18 instance World IO where
   19     readUtf8File path = decodeUtf8 <$> readFileBS path
   20     writeUtf8File path content = writeFileBS path $ encodeUtf8 content
   21 
   22     doesFileExist = System.Directory.doesFileExist
   23     doesDirectoryExist = System.Directory.doesDirectoryExist
   24     listDirectory = System.Directory.listDirectory
   25 
   26     getProgName = fmap Text.pack System.Environment.getProgName
   27 
   28     getStdin = decodeUtf8 <$> toStrict <$> Lazy.getContents
   29     getLine = Data.Text.IO.getLine
   30     putStr = Data.Text.IO.putStr
   31     putStrLn = Data.Text.IO.putStrLn
   32     writeStdout content = putBS $ encodeUtf8 content
   33     flushStdout = System.IO.hFlush stdout
   34     putStrStderr = Data.Text.IO.hPutStr stderr
   35     putStrLnStderr = Data.Text.IO.hPutStrLn stderr
   36 
   37     exitFailure = System.Exit.exitFailure
   38     exitSuccess = System.Exit.exitSuccess