Closed bergmark closed 10 years ago
This looks good. The fact that the typeclass constraint is restricted to showConstant a a
(i.e. the type variables are the same on both sides) suggests that there's something better to be found, but this functionality and the TH will help to reduce boiler plate in the interim.
What's a use case where you want ShowConstant a b
? If you want to be able to compare a text
column where the haskell representation is Text
one one side and String
on the other?
ShowConstant a b
wouldn't help with comparing Wire Text
with Wire String
.
The use case is when you have something like a Wire ProductId
field, where the underlying Postgres datatype is a text
. You might then want ShowConstant String ProductId
and ShowConstant Text ProductId
. However, it's also arguable that you should only have ShowConstant ProductId ProductId
, so we still need to play around with the design a bit and see what works best I think.
TH is in a separate module, as it is for
RunQuery
. Id prefer if the top level module for each would re-export the TH functions but that requires moving things around a bit so I didn't do that.Closes #50