[Haskell-cafe] ANNOUNCE: lenses -- Simple Functional Lenses

Martijn van Steenbergen martijn at van.steenbergen.nl
Thu Sep 3 05:50:47 EDT 2009


Job Vranish wrote:
> A simple but powerful implementation of function lenses (aka functional 
> references, accessors, etc..).

Nice! I will definitely give it a whirl when I pick up my MUD again. I'm 
currently using accessors there. I see your functions are limited to use 
in the state monad--you're right, I've never used accessors outside of a 
state monad yet.

I'm somewhat sad that you didn't capture lenses in a datatype, because 
it is such a nice example of a Category instance. I would like to see 
how to compose lenses to access deeper fields--I use nested data 
structures and would like to modify fields that are hidden deeper in the 
state. Can you perhaps add an example to show that?

Thanks!

Martijn.



More information about the Haskell-Cafe mailing list