[Haskell-cafe] updating multiple fields of a record with lenses

felipe zapata tifonzafel at gmail.com
Mon Nov 4 22:51:04 UTC 2013

 Dear Haskellers,

 let's  suppose I have the following lenses

 data Foo = Foo { _a :: String
                  _b :: [Double]
                  _c :: Vector Double
                  _d :: Int
                  .............. (more fields)
                  _z :: Double

Now, I want to update fields a,b,c and d without changing the rest.
What is the functional way of doing it ?

Surely there a function smarter than

 set a "String" . set b [1,2,3] . set c  <1,2,3> . set d 4 $ foo

 can some please help me with it?

 Thanks in advance,

   Felipe Z.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20131104/423da6f7/attachment.html>

More information about the Haskell-Cafe mailing list