
8 Jul
2010
8 Jul
'10
7:48 p.m.
On 08.07.2010 11:15, Michael Mossey wrote:
Whoa, I just realized I'm not using 'modify' to full advantage. This can be written
incrCursor = modify incrCursor' incrCursor' (PlayState cursor len verts doc) = PlayState (min (cursor+1)(len - 1)) len verts doc)
Thats what lambdas are good for: incrCursor = modify $ \p@(PlayState c l _ _) -> p { cursor = min (c+1) (l-1) } Or... incrCursor = modify $ \p@PlayState { cursor = c, len = l } -> p { cursor = min (c+1) (l-1) } :)