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