
19 Jan
2002
19 Jan
'02
11:43 p.m.
At 2002-01-19 08:16, Marcin 'Qrczak' Kowalczyk wrote:
Here is mine. The same code can work with MVars too, as long as the order of operations is consistent with the empty/full state. The empty/full state is real for MVars and imagined for IORef/STRef.
Could you simply the interface if you consider (MVar a) to hold a (Maybe a)? class Monad m => Ref m a r | r -> m a where newRef :: a -> m r getRef :: r -> m a setRef :: r -> a -> m () modifyRef :: r -> (a -> m a) -> m () instance Ref (ST s) a (STRef s a) where ... instance Ref IO a (IORef a) where ... instance Ref IO (Maybe a) (MVar a) where ... -- Ashley Yakeley, Seattle WA
8571
Age (days ago)
8571
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ashley Yakeley