[Haskell-cafe] Postgresql Intervals with Opaleye

info at rotnetix.com info at rotnetix.com
Tue Jan 6 00:56:10 UTC 2015

Got it kind of working, for some reason the interval type in my postgres 
instance does not correspond to the parser from kqr but i managed to 
implement a version that kind of works.  More importantly the experience 
has been great for understanding how to do my own conversion types.  Thanks 
for the help.

On Saturday, January 3, 2015 9:53:31 PM UTC+11, Tom Ellis wrote:
> On Tue, Dec 30, 2014 at 04:59:29PM -0800, in... at rotnetix.com <javascript:> 
> wrote: 
> > That might be tricky... 
> >  See https://github.com/lpsmith/postgresql-simple/pull/115, it seems 
> like 
> > it is not trivial to get the conversions to haskell types correct. 
> > 
> > Look like I am back to native SQL for that one.   
> As lpsmith says here 
> https://github.com/lpsmith/postgresql-simple/pull/115#issuecomment-48754627 
> you can use the attached patch in your own code to get a conversion from 
> `interval` to `DiffTime`.  It will have a few strange corner cases but you 
> will probably find you never hit them. 
> Once you've done that you can make them suitable for Opaleye by writing 
>     data PGInterval 
>     instance QueryRunnerColumnDefault PGInterval DiffTime where 
>           queryRunnerColumnDefault = fieldQueryRunnerColumn 
> (you may have to import something from Opaleye.Internal.RunQuery). 
> Please let me know how you get on with that, if you try it. 
> Tom 
> _______________________________________________ 
> Haskell-Cafe mailing list 
> Haskel... at haskell.org <javascript:> 
> http://www.haskell.org/mailman/listinfo/haskell-cafe 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20150105/6a600825/attachment-0001.html>

More information about the Haskell-Cafe mailing list