[ create a new paste ] login | about

Link: http://codepad.org/6SMov1TE    [ raw code | output | fork ]

Haskell, pasted on Apr 12:
1
2
3
4
5
6
7
8
9
10
11
12
13
import Data.STRef
import Control.Monad.ST

newtype Poly r = Poly (forall s. ST s r)

runST' :: Poly r -> r
runST' (Poly a) = runST a

main = print $ runST' $ Poly (do
    ref <- newSTRef 42
    modifySTRef ref (*2)
    readSTRef ref
    )


Output:
1
84


Create a new paste based on this one


Comments: