[Haskell-beginners] Rewriting bits of a data structure
adrian.alexander.may at gmail.com
Tue May 21 18:35:35 CEST 2013
I have a lot of ugly code like this:
data Thing = Thing Int Int Int Int Int
rewriteFourth :: Int -> Thing -> Thing
rewriteFourth x (Thing a b c _ e) = Thing a b c x e
Is there a better way?
It was thinking about state monads that reminded me of this junk that I'd
already written a while ago. Maybe it can be done by applying five StateT
transformers, but I'm not entirely sure how to write that, or if there's a
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners