conduit offers the following exercise:
Write a conduit that consumes a stream of Ints. It takes the first Int from the stream, and then multiplies all subsequent Ints by that number and sends them back downstream. You should use the mapC function for this.
Here's what I came up with:
multiplier :: Monad m => ConduitM Int Int m () multiplier = do mx <- await case mx of Nothing -> return () Just x -> mapC (* x)
After reloading the REPL, I ran it:
λ: >runConduitPure $ yieldMany [1..5] .| multiplier .| sinkList [2,3,4,5] λ: >runConduitPure $ yieldMany [3..5] .| multiplier .| sinkList [12,15] λ: >runConduitPure $ yieldMany  .| multiplier .| sinkList