It's both `Pipes.Prelude.stdinLn` and `Pipes.Prelude.fold`.

The fold can't finish until the input is done and the input is not done
until you hit Ctrl-D.

To get a continuously updating fold, use `Pipes.Prelude.scan` instead.
This will output the current result of the fold after every input without
having to wait until EOF.
On May 19, 2014 5:00 PM, "Pierre R" <[email protected]> wrote:

>
>
> On Monday, May 19, 2014 10:24:42 PM UTC+2, Gabriel Gonzalez wrote:
>>
>> It reads from standard input so you either have to type some lines in and
>> hit Ctrl-D or pipe a file to standard input using the shell.
>>
>
> So it is actually `Pipes.Prelude.fold" that makes the program to wait for
> the EOF signal before returning `ls` in
>
> ls <- purely fold (lastN 10) stdinLn
>
>
>  On May 19, 2014 4:17 PM, "Pierre R" <[email protected]> wrote:
>>
>>>
>>>
>>> On Monday, May 12, 2014 4:27:37 AM UTC+2, Gabriel Gonzalez wrote:
>>>>
>>>>  Earlier today I wrote up a fold for somebody else for retrieving the
>>>> last N elements of a sequence.  That's the non-trivial bit:
>>>>
>>>> http://lpaste.net/103997<http://www.google.com/url?q=http%3A%2F%2Flpaste.net%2F103997&sa=D&sntz=1&usg=AFQjCNGn-hu-CTTeuqPcUTfgK2xhH7QjHg>
>>>>
>>>>
>>> I am almost ashamed to ask but I fail to see why the `main` (in the
>>> above lpaste) does not output a thing
>>>
>>> while it works as expected with a file
>>>
>>> main = withFile "test" ReadMode $ \hIn -> do
>>>         ls <- purely fold (lastN 5) $ P.fromHandle hIn
>>>         runEffect $ for (each ls) (lift . putStrLn)
>>>
>>>
>>>  --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>>
>>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
>

-- 
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 [email protected].
To post to this group, send email to [email protected].

Reply via email to