
Michael Mossey wrote:
incrCursor :: State PlayState () incrCursor = cur <- gets playState_cursor len <- gets playState_len let newCur = min (cur+1) (len-1) modify (playState_update_cursor newCur)
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) Hmm, I'm already feeling better about the State monad. Additional question: what is proper terminology here? "incrCursor is a monad" "incrCursor is a monadic function" "incrCursor is a monadic type" "State is a monad" "State is a type constructor of a monad" "State is a monadic type" "incrCursor is a monadic computation" Thanks, Mike