Skip to content

Instantly share code, notes, and snippets.

@arianvp
Created August 22, 2017 11:46
Show Gist options
  • Save arianvp/4ad59068b0baa02d5b56c9725627c064 to your computer and use it in GitHub Desktop.
Save arianvp/4ad59068b0baa02d5b56c9725627c064 to your computer and use it in GitHub Desktop.
import Control.Monad.IO.Class
import Control.Monad.Codensity
import System.IO
managedActions :: Codensity IO ()
managedActions = do
input <- Codensity $ withFile "in.txt" ReadMode
output <- Codensity $ withFile "out.txt" WriteMode
contents <- liftIO $ hGetContents input
liftIO $ hPutStr output contents
main :: IO ()
main = do
lowerCodensity managedActions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment