Ollie, your streaming-postgresql-simple is really interesting. I didn't
know about "single row mode" streaming[1]. I can imagine it's faster than
streaming using a cursor since you don't have to send back a "FETCH FORWARD
$chunkSize" command for every chunk that you want to fetch. Instead you
only read from a socket and push each result on the stream.

[1]
https://www.postgresql.org/docs/current/static/libpq-single-row-mode.html

On 30 July 2017 at 16:52, Oliver Charles <[email protected]> wrote:

> You might also want to look at streaming-postgresql-simple for similar
> prior art.
>
> Ollie
>
> On Sun, 30 Jul 2017, 3:47 pm Bas van Dijk, <[email protected]> wrote:
>
>> I like the ListT suggestion and just implemented it.
>>
>> I don't understand how I can get rid of SafeT by using Managed. You're
>> talking about Managed from your managed package right?
>>
>> On 30 July 2017 at 15:58, Gabriel Gonzalez <[email protected]> wrote:
>>
>>> Looks pretty straightforward to me
>>>
>>> The only other suggestion I'd provide is to also provide a `Managed`
>>> version of the same `Producer`, with this type:
>>>
>>>     query
>>>         :: (Default QueryRunner columns haskells, MonadIO m,
>>> MonadMask m)
>>>         => Connection -> Query columns -> Managed
>>> (Producer haskells m ())
>>>
>>> Also, since it doesn't use the return value, you could even use the
>>> simpler `ListT` type instead:
>>>
>>>     query
>>>         :: (Default QueryRunner columns haskells, MonadIO m,
>>> MonadMask m)
>>>         => Connection -> Query columns -> Managed (ListT m haskells)
>>>
>>> ... and then you can always convert that back to a `Producer` using
>>> `enumerate` if necessary
>>>
>>> On Jul 29, 2017, at 2:54 PM, Bas van Dijk <[email protected]> wrote:
>>>
>>> Hello,
>>>
>>> I just started playing with pipes and I really like it so far. For my
>>> first project I would like to create a Producer for opaleye query results.
>>> I came up with the following:
>>>
>>>   https://github.com/basvandijk/pipes-opaleye/blob/
>>> master/src/Pipes/Opaleye/RunQuery.hs
>>>
>>> Is that the correct way of doing it? What can be improved?
>>>
>>> Thanks,
>>>
>>> Bas
>>>
>>> --
>>> 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].
>>
> --
> 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