[Haskell-cafe] pipes Producer combination
Ben Franksen
ben.franksen at online.de
Mon Jun 13 17:58:38 UTC 2022
On 6/13/22 14:24, Ben Franksen wrote:
> On 6/13/22 10:06, PICCA Frederic-Emmanuel wrote:
>> I would like to combine Producers in order to create a Producer of
>> another type whcih combine these values
>>
>> I want a Producer of the 'A' type
>>
>> data A :: A a b
>>
>> by I have a Producer of 'a' values and another on of 'b' values.
>> what is the best way to create from thoses two producers a Producer
>> of 'A' ?
>> Is ther a Generic way to automatically generate these combine Producers.
>> In my programmes, I will have plenty of these combine Producers.
>
> The intuitive thing I would try is to use Applicative i.e.
>
> A <$> a_producer <*> b_producer
>
> but I haven't tested if it works with pipes.
There is also pipes' zipWith operator:
https://hackage.haskell.org/package/pipes-4.3.16/docs/Pipes-Prelude.html#g:6
--
I would rather have questions that cannot be answered, than answers that
cannot be questioned. -- Richard Feynman
More information about the Haskell-Cafe
mailing list