Re: Optics?

2021-10-03 Thread Alan & Kim Zimmerman
With a pointer from Vlad and some study of the lens tutorial, I made a proof of concept at [1]. I am deliberately not using the existing lens library as I envisage this code ending up in GHC. Alan [1]

Re: Optics?

2021-10-03 Thread Vladislav Zavialov
Hi Alan, Your pair of functions can be packaged up as a single function, so that getEpa :: a -> EpaLocation setEpa :: a -> EpaLocation -> a becomes lensEpa :: forall f. Functor f => (EpaLocation -> f EpaLocation) -> (a -> f a) And the get/set parts can be recovered

Optics?

2021-10-03 Thread Alan & Kim Zimmerman
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

GHC indecisive whether matching on GADT constructors in arrow notation is allowed

2021-10-03 Thread Alexis King
Hi, I’ve been working on bringing my reimplementation of arrow notation back up to date, and I’ve run into some confusion about the extent to which arrow notation is “supposed” to support matching on GADT constructors. Note [Arrows and patterns] in GHC.Tc.Gen.Pat suggests they aren’t supposed to