[Haskell-cafe] Re: Composing functions with runST

Yitzchak Gale gale at sefer.org
Mon Jan 1 08:30:35 EST 2007


The plot thickens...

It seems that I can't even use STRefs.
Something is really wrong here.

Prelude Control.Monad.ST Data.STRef> runST $ do {r<-newSTRef 2; readSTRef r}

<interactive>:1:8:
    Couldn't match expected type `forall s. ST s a'
           against inferred type `a1 b'
    In the second argument of `($)', namely
        `do r <- newSTRef 2
            readSTRef r'
    In the expression:
          runST
        $ (do r <- newSTRef 2
              readSTRef r)
    In the definition of `it':
        it = runST
           $ (do r <- newSTRef 2
                 readSTRef r)


More information about the Haskell-Cafe mailing list