Where prelude alternatives/ classes and types to get values?
ndmitchell at gmail.com
Sat Feb 17 11:01:17 EST 2007
> 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 ()
... = do (New count) <- modify ioCounterRef (+1)
= do newcount <- modifyIORef ioCounterRef (+1)
It already exists :)
More information about the Libraries