Closed kokobd closed 1 year ago
Probably better to put them in the template-haskell
package? I'm not sure, though.
My gut instinct is that template-haskell
is a domain-independent library, and so it seems weirder to for users of template-haskell
to depend on time
than vice-versa. template-haskell
seems pretty locked to specific GHC releases, whereas adding new instances to time
should be a bit easier to publish? (Sadly, th-compat
will be unusable here due to dep footprint, so we'll probably have to CPP it like time-qq
does.)
Can we use DeriveLift
?
https://github.com/brendanhay/amazonka/pull/677/files
Looks like it, for everything except DiffTime
, which does not export its constructor.
OK, checking with the CLC in case there's a problem with time
depending on template-haskell
.
I think the dependency is OK. You can make a PR, however, there may not be instance Lift Fixed
, which should be added to template-haskell
.
I've raised an issue in template-haskell
: https://gitlab.haskell.org/ghc/ghc/-/issues/22953.
I think we can first release a version without relying on instance Lift Fixed
. Instead, manually implement Lift
for DiffTime
using diffTimeToPicoseconds
. This also makes time
compatible with older versions of template-haskell
.
The primary problem with lifting DiffTime
is that it doesn't export its contstructor. The way Amazonka works around it is to call fromEnum
, lift that, then call toEnum
. Seems to work fine.
Can we provide instances of
Language.Haskell.TH.Syntax.Lift
for types intime
, likeUTCTime
,DiffTime
, etc, so that time can be used in TH splices. If there aren't major blockers (shouldtime
depend ontemplate-haskell
?), I'll be happy to submit a PR.