On 2017-01-22 17:56, Gabriel Gonzalez wrote:
> The only thing I would add to Daniel's answer is that you can use the
> `managed` library to simplify the type a little bit to:
>
> query' :: Text -> [SqlValue] -> Managed (Maybe Int, Producer
> [SqlValue] IO ())
>
Ah, thanks, I'll have a look at managed too.
> Also, since you aren't using the return value of the `Producer`, you can
> simplify it even further by using `ListT`:
>
> query' :: Text -> [SqlValue] -> Managed (Maybe Int, ListT IO [SqlValue])
>
> It's not clear to me, though, why each read from the database returns a
> list of `SqlValue`s, though
Oh, that's just because SqlValue is a the value in a single column, so
[SqlValue] is the full row. (I have no need for anything more fancy to
map rows to data structures.)
Thanks for the suggestions Gabriel and Daniel.
Regards,