Closed highfly22 closed 6 years ago
To automatically derive a Flat instance for a data type, the data type must be an instance of Generic.
Unfortunately, this is not the case for Day.
See https://github.com/fpco/store/blob/247f2863bed0f5c1003ab835075b6dcafb9aa773/src/Data/Store/Internal.hs#L669 for an instance of Day
for store
– I suppose it'd be something like (completely untested)
size = Data.Flat.Encoder.Size.sInteger
encode = Data.Flat.encode (Time.toModifiedJulianDay d)
decode = Time.ModifiedJulianDay <$> Data.Flat.decode
(it might make sense for flat
to also include some instances for the popular non-generic types? or would it be better to have that in a flat-orphans package to avoid deps?)
Is there anything I can help with to make flat-orphans
possible? Will anyone support the idea?