
17 Feb
2007
17 Feb
'07
11:01 a.m.
Hi
I could imagine a class
class ModifyIO m c where modify :: IORef a -> ( a -> a ) -> m c
m would have to be IO, c would be a bit pointless - so IO () is a better return type. You can then Hoogle for it: IORef a -> (a -> a) -> IO () http://haskell.org/hoogle/?q=IORef%20a%20-%3E%20(a%20-%3E%20a)%20-%3E%20IO%2...) ... = do (New count) <- modify ioCounterRef (+1) = do newcount <- modifyIORef ioCounterRef (+1) It already exists :) Thanks Neil