[Haskell-cafe] Examples for Control.Lens.Plated?

Andrey Chudnov achudnov at gmail.com
Wed Sep 2 23:44:32 UTC 2015


Hello Cafe,
I'm considering porting some of my code that uses uniplate to lens. But 
Control.Lens.Plated is giving me headaches. So I'm looking for remedy.

Has anyone used it and willing to share examples? I hope that seeing 
some of the combinators in action would help me understand the type 
signatures and documentation. What I'm particularly interested in is the 
following:
1) implementation of something like transformBi and rewriteBi using lens
2) usage of *On, *Off and *OnOff combinators (e.g., transformMOn, 
transformMOff, transformMOnOff). What I want to understand is the 
difference between the 3 variants. Also, what does it mean to "Transform 
every element in the tree in a region indicated by a supplied Traversal" 
and how exactly does the traversal define the region.
3) any recursive tree traversals/transformations using Plated that stop 
the recursion at a certain point (e.g., upon seeing a certain constructor)

I hope this isn't too vague, but, please, let me know if it is.

/Andrey


More information about the Haskell-Cafe mailing list