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 =
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
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;
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
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;
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.