
At 2002-01-11 06:18, Jorge Adriano wrote:
The whole problem is with passing the 'r' as a parameter, which is precisly what I'm trying to avoid.
You could always pass it implicitly (using -fglasgow-exts): -- testfunc = do r <- newSTRef ('x',0) (do foo bar with ?ref = r) (c,n) <- readSTRef r return n foo :: (Num a,?ref :: STRef s (Char,a)) => ST s () foo = do (c,n) <- readSTRef ?ref writeSTRef ?ref ('a', n+1) bar :: (Num a,?ref :: STRef s (t,a)) => ST s () bar = do (c,n) <- readSTRef ?ref writeSTRef ?ref (c,n+2) tryTestFunc = runST testfunc -- Curiously, GHC isn't smart enough to infer the types of foo and bar by itself. -- Ashley Yakeley, Seattle WA
participants (1)
-
Ashley Yakeley