Gabriel Gonzalez <[email protected]> writes: > Alright, so `lens-4.0` unlocks a neat new feature: we can now define > `Getter`s without incurring a dependency.
You mean without incurring a dependency on `lens` - you still need to depend on `contravariant.` A `Getter` requires a co- & contravariant functor. However, you can define `Getting`s (which chooses `Const` as such a functor), which I think is what you meant. As an aside, the `lens` wiki [1] mentions that it's not normally of much use to give people these things [2]: > Getters are not usually useful to define as a package > maintainer. Users of lens can build getters on the fly by using > > to :: (s -> a) -> IndexPreservingGetter s a > > if you provide a function from the larger type to the subcomponent. I would imagine the "same syntax" you mention is about being able to use the `lens` operators - so if you want that syntax you'll have a dependency on `lens` and using `to` doesn't cost you much more. However, if you use `Getter` the *only* value (I can see) is to remove the need to use `to` at the cost of tieing everyone in to some variant of `lens` operators/functions. What did I miss? :) - ocharles Sorry for double posting this to you Gabriel, I forgot to hit reply all >.< --- [1]: https://github.com/ekmett/lens/wiki [2]: https://github.com/ekmett/lens/wiki/How-can-I-write-lenses-without-depending-on-lens%3F#wiki-getter -- You received this message because you are subscribed to the Google Groups "Haskell Pipes" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
