purescript-protobuf icon indicating copy to clipboard operation
purescript-protobuf copied to clipboard

Document profunctor-lens usage?

Open jamesdbrock opened this issue 5 years ago • 1 comments
trafficstars

https://pursuit.purescript.org/packages/purescript-profunctor-lenses/

jamesdbrock avatar Sep 15 '20 15:09 jamesdbrock

To support profunctor-lenses, what we would want to do is to code-generate a lens for each field name.

https://thomashoneyman.com/articles/practical-profunctor-lenses-optics/#lenses

-- This lens focuses on the "name" field of a record; we have to construct
-- this one ourselves.
_name :: forall a r. Lens' { name :: a | r } a
_name = prop (SProxy :: SProxy "name")

jamesdbrock avatar May 25 '21 01:05 jamesdbrock