kenbot / goggles

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

Haskell style commas, ranges for indices #9

Closed kenbot closed 7 years ago

kenbot commented 7 years ago

Would this be a sensible extension to the index behaviour?

get"$kittens[0, 2, 3..10]"

Allowing index interpolation in to any position. The trouble is the ".." requires some concept of an enumeration - is there a standard typeclass for this in the std lib? Does it yield a Traversal over all those values, or an Optional of a tuple containing the values? What Would Haskell Do?

kenbot commented 7 years ago

I find I don't care about this very much. It adds a bunch of weight to the syntax, for little benefit. The tupling syntax in #10, if implemented, would suck the wind out of much of the motivation.

If we attract enough users, and enough users want something like this, the issue can be revisited.