tcfail068.hs:14:9: error: • Couldn't match type ‘s1’ with ‘s’ ‘s1’ is a rigid type variable bound by a type expected by the context: forall s1. GHC.ST.ST s1 (IndTree s a) at tcfail068.hs:(13,15)-(14,31) ‘s’ is a rigid type variable bound by the type signature for: itgen :: forall a s. Constructed a => (Int, Int) -> a -> IndTree s a at tcfail068.hs:11:1-55 Expected type: GHC.ST.ST s1 (IndTree s a) Actual type: GHC.ST.ST s1 (STArray s1 (Int, Int) a) • In the first argument of ‘runST’, namely ‘(newSTArray ((1, 1), n) x)’ In the expression: runST (newSTArray ((1, 1), n) x) In an equation for ‘itgen’: itgen n x = runST (newSTArray ((1, 1), n) x) • Relevant bindings include itgen :: (Int, Int) -> a -> IndTree s a (bound at tcfail068.hs:12:1) tcfail068.hs:19:9: error: • Couldn't match type ‘s1’ with ‘s’ ‘s1’ is a rigid type variable bound by a type expected by the context: forall s1. GHC.ST.ST s1 (IndTree s a) at tcfail068.hs:(18,15)-(21,19) ‘s’ is a rigid type variable bound by the type signature for: itiap :: forall a s. Constructed a => (Int, Int) -> (a -> a) -> IndTree s a -> IndTree s a at tcfail068.hs:16:1-75 Expected type: GHC.ST.ST s1 (IndTree s a) Actual type: GHC.ST.ST s (IndTree s a) • In the first argument of ‘runST’, namely ‘(readSTArray arr i >>= \ val -> writeSTArray arr i (f val) >> return arr)’ In the expression: runST (readSTArray arr i >>= \ val -> writeSTArray arr i (f val) >> return arr) In an equation for ‘itiap’: itiap i f arr = runST (readSTArray arr i >>= \ val -> writeSTArray arr i (f val) >> return arr) • Relevant bindings include arr :: IndTree s a (bound at tcfail068.hs:17:11) itiap :: (Int, Int) -> (a -> a) -> IndTree s a -> IndTree s a (bound at tcfail068.hs:17:1) tcfail068.hs:24:36: error: • Couldn't match type ‘s1’ with ‘s’ ‘s1’ is a rigid type variable bound by a type expected by the context: forall s1. GHC.ST.ST s1 (IndTree s a) at tcfail068.hs:24:35-46 ‘s’ is a rigid type variable bound by the type signature for: itrap :: forall a s. Constructed a => ((Int, Int), (Int, Int)) -> (a -> a) -> IndTree s a -> IndTree s a at tcfail068.hs:23:1-87 Expected type: GHC.ST.ST s1 (IndTree s a) Actual type: GHC.ST.ST s (IndTree s a) • In the first argument of ‘runST’, namely ‘(itrap' i k)’ In the expression: runST (itrap' i k) In an equation for ‘itrap’: itrap ((i, k), (j, l)) f arr = runST (itrap' i k) where itrap' i k = if k > l then return arr else (itrapsnd i k >> itrap' i (k + 1)) itrapsnd i k = if i > j then return arr else (readSTArray arr (i, k) >>= \ val -> ...) • Relevant bindings include itrap' :: Int -> Int -> GHC.ST.ST s (IndTree s a) (bound at tcfail068.hs:26:9) itrapsnd :: Int -> Int -> GHC.ST.ST s (IndTree s a) (bound at tcfail068.hs:29:9) arr :: IndTree s a (bound at tcfail068.hs:24:23) itrap :: ((Int, Int), (Int, Int)) -> (a -> a) -> IndTree s a -> IndTree s a (bound at tcfail068.hs:24:1) tcfail068.hs:36:46: error: • Couldn't match type ‘s1’ with ‘s’ ‘s1’ is a rigid type variable bound by a type expected by the context: forall s1. GHC.ST.ST s1 (c, IndTree s b) at tcfail068.hs:36:45-63 ‘s’ is a rigid type variable bound by the type signature for: itrapstate :: forall b a c s. Constructed b => ((Int, Int), (Int, Int)) -> (a -> b -> (a, b)) -> ((Int, Int) -> c -> a) -> (a -> c) -> c -> IndTree s b -> (c, IndTree s b) at tcfail068.hs:(34,1)-(35,62) Expected type: GHC.ST.ST s1 (c, IndTree s b) Actual type: GHC.ST.ST s (c, IndTree s b) • In the first argument of ‘runST’, namely ‘(itrapstate' i k s)’ In the expression: runST (itrapstate' i k s) In an equation for ‘itrapstate’: itrapstate ((i, k), (j, l)) f c d s arr = runST (itrapstate' i k s) where itrapstate' i k s = if k > l then return (s, arr) else (itrapstatesnd i k s >>= \ (s, arr) -> ...) itrapstatesnd i k s = if i > j then return (s, arr) else (readSTArray arr (i, k) >>= \ val -> ...) • Relevant bindings include itrapstate' :: Int -> Int -> c -> GHC.ST.ST s (c, IndTree s b) (bound at tcfail068.hs:38:9) itrapstatesnd :: Int -> Int -> c -> GHC.ST.ST s (c, IndTree s b) (bound at tcfail068.hs:41:9) arr :: IndTree s b (bound at tcfail068.hs:36:34) itrapstate :: ((Int, Int), (Int, Int)) -> (a -> b -> (a, b)) -> ((Int, Int) -> c -> a) -> (a -> c) -> c -> IndTree s b -> (c, IndTree s b) (bound at tcfail068.hs:36:1)