From: Colin P. A. <co...@co...> - 2009-09-28 19:33:44
|
>>>>> "Justin" == Justin Bailey <jgb...@gm...> writes: Justin> The type used is not determined by HaskellDB. Your application Justin> determines the type it expects, and the appropriate Justin> Convertible instance is selected. If that doesn't make Justin> sense, what I mean is the type signature of your result Justin> determines the type to which the value will be Justin> converted. For example, if your function is named Justin> "getTimestampRows", you can control the type converted to Justin> via it's signature: Justin> getTimestampRows :: IO [Record (Col1 (Expr Day)) ... )] Justin> or Justin> getTimestampRows :: IO [Record (Col1 (Expr ZonedTime)) Justin> ... )] Justin> or Justin> getTimestampRows :: IO [Record (Col1 (Expr UTCTime)) Justin> ... )] I'm lost here. HaskellDB is expecting a System.Time.CalendarTime (because I defined the column as a CalendarT - there was no other choice in the constructors from FireldDesc), but if I look at the documentation for System.Time, it says it is deprecated - look at Data.Time instead. If I look there, I see Data.Time.Clock.UTCTime, which I guess is what you are referring to in the line above. But if I try to write such a record with: ct <- getCurrentTime DB.insert db IT.imageTable (<snip> # IT.uploadTime <<- ct) the compiler complains: Couldn't match expected type `System.Time.CalendarTime' against inferred type `UTCTime' In the second argument of `(<<-)', namely `ct' In the second argument of `(#)', namely `IT.uploadTime <<- ct' How do I control this with a signature? -- Colin Adams Preston Lancashire |