Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import Effects
import Effect.File
import Effect.StdIO
import Control.IOExcept
readFile : Eff (FileOpResult (List String)) [FILE R]
readFile = readAcc [] where
readAcc : List String -> Eff (FileOpResult (List String)) [FILE R]
readAcc acc = if (not !eof)
then do
(Result str) <- readLine
readAcc (str::acc)
else pure $ Result (reverse acc)
dumpFile : String -> Eff () [FILE (), STDIO]
dumpFile name = do
Success <- open name Read
| (FError _) => do putStrLn "Error!"
(Result fcontents) <- readFile
| (FError _) => do close
putStrLn "Error!"
putStrLn (show fcontents)
main : IO ()
main = run (dumpFile "input.txt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.