5 import Prelude hiding (read)
11 new :: Register a => ST s (RAT s a b)
12 write :: Register a => RAT s a b -> a -> b -> ST s ()
13 remove :: Register a => RAT s a b -> a -> ST s ()
14 read :: Register a => RAT s a b -> a -> ST s (Maybe b)
15 clear :: Register a => RAT s a b -> ST s ()
17 type RAT s a b = (STArray s a (Maybe b),a,a)
20 = do { mapM (\x -> writeSTArray xs x Nothing) [x1 .. x2]
25 = do { a <- read rat r
26 ; let res = do { v <- a
27 ; return (Reg (Virtual v (Just r)) x)
29 `catchEx` Reg (Real r) x
32 replace rat x = return $ convert x
36 = do { x <- newSTArray (minBound,maxBound) Nothing
37 ; return (x,minBound,maxBound)
40 write (xy,_,_) x y = writeSTArray xy x (return y)
41 remove (xy,_,_) x = writeSTArray xy x Nothing
42 read (xy,_,_) x = readSTArray xy x