[Haskell-cafe] Conduit : is it possible to write this function?
Erik de Castro Lopo
mle+hs at mega-nerd.com
Mon Aug 26 09:51:03 CEST 2013
Michael Snoyman wrote:
> You can build this up using the >=< operator[1] in stm-conduit, something
> like:
>
> eitherSrc :: MonadResourceBase m
> => Source (ResourceT m) a -> Source (ResourceT m) b -> Source
> (ResourceT m) (Either a b)
> eitherSrc src1 src2 = do
> join $ lift $ Data.Conduit.mapOutput Left src1 >=<
> Data.Conduit.mapOutput Right src2
>
> I think this can be generalized to work with more base monads with some
> tweaks to (>=<).
Thanks Michael, that looks like it will fit the bill!
Cheers,
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
More information about the Haskell-Cafe
mailing list