xc-jp / purescript-protobuf

Google Protocol Buffers for PureScript
http://pursuit.purescript.org/packages/purescript-protobuf/
BSD 3-Clause "New" or "Revised" License
54 stars 5 forks source link

Document profunctor-lens usage? #5

Open jamesdbrock opened 4 years ago

jamesdbrock commented 4 years ago

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

jamesdbrock commented 3 years ago

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")