<div dir="ltr"><div>There is a new player in this field named Hasql, which provides straightforward mappings to list and vector. On top of that the API is orders of magnitude lighter and the performance is up to 2 and 7 times better compared to "postgresql-simple" and "HDBC". See the results of benchmarks: <a href="http://nikita-volkov.github.io/hasql-benchmarks/">http://nikita-volkov.github.io/hasql-benchmarks/</a></div><div><br></div><div>Best regards,</div><div>Nikita</div><div class="gmail_extra"><br><div class="gmail_quote">2014-12-26 9:22 GMT+03:00 Amit Aryeh Levy <span dir="ltr"><<a href="mailto:amit@amitlevy.com" target="_blank">amit@amitlevy.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    I doubt you'd need to extend the built-in conversion functions for
    postgresql-simple. In particular there is already an instance fo
    `ToField` for:<br>
    <br>
    `ToField a => ToField (Vector a)`<br>
    <br>
    meaning there is an instance for the type `Vector (Vector Float)`
    (because `Float` is also an instance of `ToField`). I believe that
    should work out of the box for you. I've never tried using two
    dimensional arrays, but I've used postgresql arrays as Vectors using
    postgresql-simple a lot, and it works great out of the box.<br>
    <br>
    If you're interested in going just a little bit higher level without
    abandoning postgresql-simple, I'd suggest postgresql-orm (shameless
    plug), which gives you an very lightweight ORM layer on top of
    postgresql-simple -- specifically a safe query DSL.<br>
    <br>
    -Amit<div><div class="h5"><br>
    <br>
    <div>On 12/25/2014 07:36 PM, Riaan wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr"><span style="font-size:13px">This is a question
          about database query libraries.  I am trying to do some
          analytics on a Postgresql database and up to now have been
          using Database.HDBC for most of my querying.</span>
        <div style="font-size:13px"><br>
        </div>
        <div style="font-size:13px">One of the columns on the database
          is a two dimensional float8 array.  I tried using
          Database.PostgreSQL.Simple but got stuck on this array as I
          could not figure out how to extend the built in conversion
          functions to cater for something like this.  So went back to
          HDBC.  But now my queries are starting to get fairly long and
          I have been looking at libraries like Persistent with
          Esqualeto, HaskellDB and Groundhog to make my queries a little
          more composable and type safe.  </div>
        <div style="font-size:13px"><br>
        </div>
        <div style="font-size:13px">However I have not been able to find
          any examples of any of these libraries using postgres arrays
          and given my postgresql-simple experience I worried that I
          might similarly be unable, because of my low level of haskell
          ability, to extend the conversion functions.</div>
        <div style="font-size:13px"><br>
        </div>
        <div style="font-size:13px">So to my question.  Does anyone have
          experience with one of these libraries in dealing with
          postgresql arrays and could someone perhaps send me a simple
          example that I could use as a basis.  Failing that, can anyone
          advise me on which of these libraries have the most haskell
          newbie (LYAH trained, but still struggling with RWH) friendly
          approach to writing new conversion functions?</div>
        <div style="font-size:13px"><br>
        </div>
        <div style="font-size:13px">Thanks</div>
        <div style="font-size:13px">Riaan</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
Haskell-Cafe mailing list
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div></div>