I wrote the following function:
(.>=.) :: Num a => STRef sa -> a -> Bool r .>=. x = runST $ do v <- readSTRef r return $ v >= x
but when I tried to compile, I got the following error:
Could not deduce (s ~ s1) from the context (Num a) bound by the type signature for .>=. :: Num a => STRef sa -> a -> Bool at test.hs:(27,1)-(29,16) `s' is a rigid type variable bound by the type signature for .>=. :: Num a => STRef sa -> a -> Bool at test.hs:27:1 `s1' is a rigid type variable bound by a type expected by the context: ST s1 Bool at test.hs:27:12 Expected type: STRef s1 a Actual type: STRef sa In the first argument of `readSTRef', namely `r' In a stmt of a 'do' expression: v <- readSTRef r
Can anyone help?
user1023733
source share