I accidentally replied directly to Oliver, so I'm just recopying my 
response here:

Yeah, you're right.  The thing that convinced me was that `to` is so 
> syntactically cheap that there's no benefit to defining getters.  I will 
> revert them back to functions of `Producer`s. 
>

On Thursday, January 30, 2014 7:53:52 PM UTC+7, Oliver Charles wrote:
>
> Gabriel Gonzalez <[email protected] <javascript:>> 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].

Reply via email to