Skip to content

Instantly share code, notes, and snippets.

@kevinmeredith
Created November 24, 2017 02:17
Show Gist options
  • Save kevinmeredith/c164ee1b2e30446f7aeab6637cd865a5 to your computer and use it in GitHub Desktop.
Save kevinmeredith/c164ee1b2e30446f7aeab6637cd865a5 to your computer and use it in GitHub Desktop.
Working on examples/exercises of snoyberg/conduit README
$cat app/Main.hs
module Main where

{-# LANGUAGE ExtendedDefaultRules #-}

import Control.Monad.Trans.List
import Conduit
import Control.Applicative

-- mapMC :: Monad m => (a -> m b) -> Conduit a m b

iterMC' :: Monad m => (a -> m ()) -> Conduit a m a
iterMC' f = mapMC (\a -> (f a) >> return a)


--  (<*>) :: f (a -> b) -> f a -> f b
-- liftA :: Applicative f => (a -> b) -> f a -> f b
sink' :: Monad m => ConduitM Int o m (String, Int)
sink' = liftA2 (,) a b
  where
   a = takeC 5 .| mapC show .| foldC
   b = sumC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment