Skip to content

Instantly share code, notes, and snippets.

@dtchepak
Created June 15, 2012 07:00
Show Gist options
  • Save dtchepak/2935100 to your computer and use it in GitHub Desktop.
Save dtchepak/2935100 to your computer and use it in GitHub Desktop.
IO example from Haskell.org IO tutorial (http://www.haskell.org/tutorial/io.html)
-- IO example from http://www.haskell.org/tutorial/io.html
-- copies one file to another:
main = do fromHandle <- getAndOpenFile "Copy from: " ReadMode
toHandle <- getAndOpenFile "Copy to: " WriteMode
contents <- hGetContents fromHandle
hPutStr toHandle contents
hClose toHandle
putStr "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment