Created
March 15, 2019 02:54
-
-
Save ivanbrennan/b037448f368c660bc84da5ae1eaf060c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env nix-shell | |
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (ps: [ps.conduit])" | |
import Conduit | |
trans :: Monad m => ConduitT Int Int m () | |
trans = do | |
takeC 3 .| mapC (+ 1) | |
takeC 3 .| mapC (* 2) | |
xs <- foldlC (\z x -> x : (take 2 z)) [] | |
yieldMany (reverse xs) .| mapC (* 10) | |
main :: IO () | |
main = runConduit $ yieldMany [1..10] | |
.| trans | |
.| mapM_C print |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment