|
From: Colin P. A. <co...@co...> - 2009-09-29 15:42:29
|
>>>>> "Justin" == Justin Bailey <jgb...@gm...> writes:
Justin> The solution is to make "ct" have type CalendarTime, not
Justin> UTCTime. HaskellDB uses the deprecated, but still in wide
Justin> use, old-time package which exposes
Justin> System.Time.CalendarTime. You can't get a CalendarTime for
Justin> the current date direclty, but you can indirectly. Try:
Justin> clockTime <- getClockTime ct <- toCalendarTime clockTime
So this is what I was originally doing.
Justin> Or more succinctly:
Justin> ct <- getClockTime >>= toCalendarTime
Justin> Then you should be able to do your insert. Finally, you
Justin> asked:
>> How do I control this with a signature?
Justin> That's not relevant here as I was referring to the
Justin> conversion of SQL types to Haskell values. Since DBDirect
Justin> generates the code for your table, you are stuck with
Justin> CalendarTime.
But the reason I tried changing to use UTCTime was in answer to my
original problem, you said I could extract a UTCTime from it (you gave
an example function).
So I am puzzled as to how I can get a different type out from what I
put in.
But perhaps you thought I was doing the following:
Justin> DBDirect is just a convenience, though. You could make
Justin> your own definition by hand.
One of the reasons I'm using HaskellDB is I want to be sure everything
is consistent.
Justin> haskelldb-th package, which gives some Template Haskell
Justin> functions for defining tables and columns. Just FYI.
I'll take a look. Thanks.
--
Colin Adams
Preston Lancashire
|