@@ -0,0 +1,21 @@
1+-- https://github.com/snoyberg/conduit#readme
3+module ConduitExample (example) where
6+import System.Directory (removeFile)
9+ -- Pure operations: summing numbers.
10+ print $ runConduitPure $ yieldMany [1..10] .| sumC
12+ -- Exception safe file access: copy a file.
13+ writeFile "input.txt" "This is a test." -- create the source file
14+ runConduitRes $ sourceFileBS "input.txt" .| sinkFile "output.txt" -- actual copying
15+ readFile "output.txt" >>= putStrLn -- prove that it worked
17+ -- Perform transformations.
18+ print $ runConduitPure $ yieldMany [1..10] .| mapC (+ 1) .| sinkList
20+ removeFile "input.txt"
21+ removeFile "output.txt"