sgraf1337 at gmail.com
Mon Oct 4 06:54:23 UTC 2021
Hi Alan, hi Vlad,
Yes, one thing that is nice about van Laarhoven lenses is that you don't
actually need to depend on anything if all you want is export lenses in
We have also discussed using a small lens library in the past, in
The MVP would be to just depend on the Lens module defined in newer
versions of Cabal.
Am Mo., 4. Okt. 2021 um 00:35 Uhr schrieb Alan & Kim Zimmerman <
alan.zimm at gmail.com>:
> With a pointer from Vlad and some study of the lens tutorial, I made a
> proof of concept at .
> I am deliberately not using the existing lens library as I envisage this
> code ending up in GHC.
> On Sun, 3 Oct 2021 at 18:52, Vladislav Zavialov <vladislav at serokell.io>
>> Hi Alan,
>> Your pair of functions can be packaged up as a single function, so that
>> getEpa :: a -> EpaLocation
>> setEpa :: a -> EpaLocation -> a
>> lensEpa :: forall f. Functor f => (EpaLocation -> f EpaLocation)
>> -> (a -> f a)
>> And the get/set parts can be recovered by instantiating `f` to either
>> Identity or Const.
>> The nice thing about lenses is that they compose, so that if you need
>> nested access, you could define several lenses, compose them together, and
>> then reach deep into a data structure. Then lenses might offer some
>> simplification. Otherwise, an ordinary getter/setter pair is just as good.
>> - Vlad
>> > On 3 Oct 2021, at 20:40, Alan & Kim Zimmerman <alan.zimm at gmail.com>
>> > Hi all
>> > I am working on a variant of the exact printer which updates the
>> annotation locations from the `EpaSpan` version to the `EpaDelta` version,
>> as the printing happens
>> > data EpaLocation = EpaSpan RealSrcSpan
>> > | EpaDelta DeltaPos
>> > The function doing the work is this
>> > markAnnKw :: (Monad m, Monoid w)
>> > => EpAnn a -> (a -> EpaLocation) -> (a -> EpaLocation -> a) ->
>> AnnKeywordId -> EP w m (EpAnn a)
>> > which gets an annotation, a function to pull a specific location out,
>> and one to update it.
>> > I do not know much about lenses, but have a feeling that I could
>> simplify things by using one.
>> > Can anyone give me any pointers?
>> > Alan
>> > _______________________________________________
>> > ghc-devs mailing list
>> > ghc-devs at haskell.org
>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> ghc-devs mailing list
> ghc-devs at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ghc-devs