kenbot / goggles

Pleasant, yet principled Scala optics DSL
MIT License
195 stars 7 forks source link

More helpful error message for missing Each/Possible/Index implicits #20

Closed kenbot closed 7 years ago

kenbot commented 7 years ago

Currently import goggles._ is not "batteries included", meaning that the *, ? and [] operators won't do anything until implicit m.f.Each, Possible and Index instances are imported or created.

Either: a) import goggles._ should include default instance imports b) The error message should be very helpful when the missing implicit is for a Monocle-supported instance, specifically suggesting the required Monocle import.

Including a bunch of instances by default is convenient, but seems like a bad idea; most libraries (including Monocle) now separate instance or syntax imports from their core concepts. Otherwise the user will be poorly equipped to reason about the consequence when default implicit instances swordfight with new ones.

On the other hand, really helpful error messages is what Goggles is all about; the user might be mildly inconvenienced by having to import something, but they will be fully informed.

kenbot commented 7 years ago

This isn't a thing. Monocle's default instances are in the typeclass companion objects: Each, Possible, Index, etc, so scalac will automatically pick them up with no problems.