<div dir="ltr">Hi All,<div><br></div><div style>I have a lot of ugly code like this:</div><div style><br></div><div style>data Thing = Thing Int Int Int Int Int </div><div style>rewriteFourth :: Int -&gt; Thing -&gt; Thing</div>
<div style>rewriteFourth x (Thing a b c _ e) = Thing a b c x e</div><div style><br></div><div style>Is there a better way?</div><div style><br></div><div style>It was thinking about state monads that reminded me of this junk that I&#39;d already written a while ago. Maybe it can be done by applying five StateT transformers, but I&#39;m not entirely sure how to write that, or if there&#39;s a simpler fix.</div>
<div style><br></div><div style>TIA,</div><div style>Adrian.</div><div style><br></div><div style><br></div></div>