You don't need to; PGclear is called automatically some time after the Result is garbage collected. This is done by using PQclear as a finalizer on the foreign pointer that represents a Result:<div><br></div><div><a href="http://hackage.haskell.org/packages/archive/postgresql-libpq/0.8.2/doc/html/src/Database-PostgreSQL-LibPQ.html#line-2055">http://hackage.haskell.org/packages/archive/postgresql-libpq/0.8.2/doc/html/src/Database-PostgreSQL-LibPQ.html#line-2055</a><br>
<div><br><div>There is "unsafeFreeResult", which triggers the finalizer at a deterministic point in time. But I don't recommend it's use unless you really understand the basics of GHC's implementation : you can easily have a reference to the Result sitting around in a thunk even "after" you have computed some value from the Result and thrown away all other references. (Because, in fact, you haven't computed the value completely; some part of that value is actually a thunk that needs the Result to compute the rest of the value.) And even then, I'm skeptical that very many applications would truly benefit from it's use.</div>
<div><br></div><div>Best,</div><div>Leon<br><br><div class="gmail_quote">On Fri, Jun 8, 2012 at 3:03 PM, Kirk Peterson <span dir="ltr"><<a href="mailto:necrobious@gmail.com" target="_blank">necrobious@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Leon,<br>
<br>
I'm working with your haskell postgresql-libpq package and noticed<br>
that the examples form:<br>
<a href="http://www.postgresql.org/docs/9.1/static/libpq-example.html" target="_blank">http://www.postgresql.org/docs/9.1/static/libpq-example.html</a><br>
release a Result using the PGclear() function, however there is no<br>
clear function in postgresql-libpq.<br>
<br>
I'm new to libpq in general, so perhaps this is an easy question: what<br>
is the idiomatic way to clear a result using postgresql-libpq?<br>
<br>
<br>
cheers,<br>
-kirk<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
⑆<a href="http://gmail.com" target="_blank">gmail.com</a>⑆necrobious⑈<br>
</font></span></blockquote></div><br></div></div></div>