[project @ 1999-04-29 11:53:12 by simonpj]
[ghc-hetmet.git] / ghc / tests / programs / jeff-bug / RF.hs
1 module RF where
2
3 import Prelude hiding (read)
4 import LazyST
5 import Utils
6
7 import Hawk
8
9 type RF s a b = STArray s a b
10
11 new   :: (Register a,Num b) => ST c (RF c a b)
12 read  :: Register a => RF s a b -> a -> ST s b
13 write :: Register a => RF s a b -> a -> b -> ST s ()
14
15 new         = newSTArray (minBound,maxBound) 0
16 read        = readSTArray 
17 write f x z = if readOnly x then return () 
18               else writeSTArray f x z