Re: [Haskell-cafe] Is there any way to parametrize a value update using record syntax?

2011-09-07 Thread Poprádi Árpád
Hi Erik, thanks a lot! fclabels is an amazing package! My code become much clearer. Greetings, Árpád On Wed, 2011-09-07 at 00:04 +0200, Erik Hesselink wrote: 2011/9/6 Poprádi Árpád popradi_ar...@freemail.hu: i have a record with a lot of items used in a state monad. data BigData =

[Haskell-cafe] Is there any way to parametrize a value update using record syntax?

2011-09-06 Thread Poprádi Árpád
Hi all, i have a record with a lot of items used in a state monad. data BigData = BigData { data1 :: X , data2 :: X -- and so on } type MonadicEnv a = State BigData a I updates the fields in the computation with such

Re: [Haskell-cafe] Is there any way to parametrize a value update using record syntax?

2011-09-06 Thread Brandon Allbery
2011/9/6 Poprádi Árpád popradi_ar...@freemail.hu updateData1 :: X - MonadicEnv() updateData1 d = do; env - get; put env {data1 = d} updateData1 d = modify (\r - r {data1 = d}) But there is, sadly, no eta-reduced version of record update to make the \r - r ... boilerplate go away;

Re: [Haskell-cafe] Is there any way to parametrize a value update using record syntax?

2011-09-06 Thread Alexey Khudyakov
On 07.09.2011 00:56, Brandon Allbery wrote: 2011/9/6 Poprádi Árpád popradi_ar...@freemail.hu mailto:popradi_ar...@freemail.hu updateData1 :: X - MonadicEnv() updateData1 d = do; env - get; put env {data1 = d} updateData1 d = modify (\r - r {data1 = d}) But there is, sadly, no

Re: [Haskell-cafe] Is there any way to parametrize a value update using record syntax?

2011-09-06 Thread Erik Hesselink
2011/9/6 Poprádi Árpád popradi_ar...@freemail.hu: i have a record with a lot of items used in a state monad. data BigData = BigData {                   data1 :: X                 , data2 :: X                -- and so on                } updateData1 :: X - MonadicEnv() updateData1 d = do;

Re: [Haskell-cafe] Is there any way to parametrize a value update using record syntax?

2011-09-06 Thread David Barbour
2011/9/6 Erik Hesselink hessel...@gmail.com You can use the fclabels package [1] for this. It makes record labels first class, and also provides functions to update parts of a record in the state monad [2]. That's pretty nifty. Thanks for mentioning it.