Skip to content

Instantly share code, notes, and snippets.

@lucassmagal
Created April 27, 2013 14:00
Show Gist options
  • Save lucassmagal/5473232 to your computer and use it in GitHub Desktop.
Save lucassmagal/5473232 to your computer and use it in GitHub Desktop.
import System.IO
import System.IO.Unsafe
import System.Environment
import System.Directory
writeOnFile task = appendFile todoTxt (task ++ "\n")
todoTxt = home ++ "/todo.txt" where
home = unsafePerformIO getHomeDirectory
listTasks = do
withFile todoTxt ReadMode $ \handle -> do
contents <- hGetContents handle
putStr contents
@pbalduino
Copy link

Linha #2 é para quando uma versão impura não é impura o suficiente.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment