[Haskell-cafe] Chaining a map over lists with lenses

Nicola Gigante nicola.gigante at gmail.com
Fri Oct 10 15:03:16 UTC 2014


Il giorno 10/ott/2014, alle ore 16:36, Daniel Trstenjak <daniel.trstenjak at gmail.com> ha scritto:

> 
> Hi Nicola,
> 
> there's 'traversed' to access every entry of a traversable structure,
> e.g. appending a "X" at the end of each 'otherField':
> 
>   t & myField . traversed . otherField %~ (++ "X")
> 
> 
> And there's '^..' to return a list of each entry of a traversable structure:
> 
>   t ^.. myField . traversed . otherField
> 

Thank you for both the answers!

So my error was to presume that everything can be
done with (^.) (which is view, if I’m correct).

So I have to understand now, what is the & operator?

> 
> Greetings,
> Daniel

Thank you,
Nicola


More information about the Haskell-Cafe mailing list