2 ms·
so like this? import Control.Monad.ST import Data.STRef main = do let n = runST $ do n <- newSTRef 5 modifySTRef
by okasaki 12y ago
so like this?
import Control.Monad.ST
import Data.STRef
main = do
let n = runST $ do n <- newSTRef 5
modifySTRef n (+ 10)
readSTRef n
modifySTRef n (+ 10)
{-
^^^^^^
Couldn't match expected type IO t0 with actual type ST s0 ()
In the expression: main
When checking the type of the IO action main
-}
print n
- ufo 12y agoYes, more like that. There are some extra wrinkles they could add with subtyping, record types, etc but its still going to be a silly thing to patent.