Thank you David!

Have a nice weekand

четверг, 8 июня 2017 г., 18:07:47 UTC+3 пользователь David M написал:
>
> You would just change it like so. 
>
> S.mapM (\conn -> liftIO (getStr2 connection) >>= \b -> return (conn,b)) 
>
> If you want to make it more brief, perhaps 
>
> {-# LANGUAGE TupleSections #-} 
>
> S.mapM(\conn = (conn,) <$> liftIO (getStr2 conn)) 
>
> On Thu, Jun 8, 2017 at 10:57 AM,  <aqu...@gmail.com <javascript:>> wrote: 
> > Hello, Group! 
> > 
> > I implemented a scheme (strN - stream N, a, b - items of stream): 
> > 
> >    a -> b -> (a, b) 
> >    a -> b -> (a, b) 
> >    a -> b -> (a, b) 
> >    .    .     ... 
> >  str1  str2   str3 
> > 
> > i.e. from each item of str1 I get item of str2 (with network call) and 
> then 
> > combine item from str1 and item from str2 to a pair - to analize 
> combined 
> > item (because I need info from both items: a and b). 
> > 
> > In pseudocode: 
> > 
> > for a in str1Getter: 
> >   b = getStr2 a 
> >   analize(a, b) 
> > 
> > 
> > I done combining with S.zip from Streaming.Prelude. I suppose it's 
> similar 
> > to Pipes and Conduits. And this looks like: 
> > 
> > (|>) = flip $ 
> > str1Getter |> S.mapM (liftIO . getStr2 connection) |> S.zip str1Getter 
> > 
> > and sure here I got twice execution of str2 retrieving from network 
> (each 
> > request happens twice), due this zip. 
> > 
> > Would somebody help me: how to make this scheme (in simple way)? I can 
> pass 
> > a to getStr2 sure and to get from it not simple b but (a, b) but this 
> looks 
> > not cool. Is some other way to do it? 
> > 
> > 
> > /Best regards, Paul 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Haskell Pipes" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to haskell-pipe...@googlegroups.com <javascript:>. 
> > To post to this group, send email to haskel...@googlegroups.com 
> <javascript:>. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to haskell-pipes+unsubscr...@googlegroups.com.
To post to this group, send email to haskell-pipes@googlegroups.com.

Reply via email to