Closed nilscc closed 10 years ago
A simple fix would be:
deriving instance Foldable Last
This would be an orphan instance for a base-datatype though, which I don't really like.
Another other option would be to replace Last
with an in-package equivalent... I could also see about adding Foldable
and Traversable
instances to the newtypes in Data.Monoid
and provide orphans for older versions of base.. Any preference?
If you could get those instances into base that'd be probably be the cleanest solution. An in-package equivalent to Last
would work, but it'd be kind of redundant… However, if you decide to add orphan instances to your package, please make sure to put them in an empty module (e.g. Data.ProtocolBuffers.Instances
, and put an explanation to the top why it's there), since there is currently (afaik) no way to exclude instance definitions from an imported module and you could end up with unavoidable duplicate instance definitions errors otherwise. That would also make it unnecessary to check the current base version and you might just declare that module deprecated once base comes out with those instances.
I'll see what I can do, for 7.8 it's probably too late. I'll definitely add the orphan... we apparently ran across this last year, see ef819f5b6a559f01685f00808dfe2fa01443f3e4, but never developed a proper fix.
Does change 2056f20e1697b40dc3a769cf8357bcd3ef2bbe5f meet your needs?
I've pushed 0.1.3 to Hackage, please reopen this ticket if you run into any issues.
Looks good!
The following code sample
leads to the error: