Newbie ST/Monad Question

Carl McTague mctague@one.net
Fri, 24 Aug 2001 11:28:56 -0600


Dear Haskell Hackers,

Please forgive me if I've sent this is the wrong mailing list.

I'm writing a simple union/find implementation using the ST library,
but I've run into some kind of conceptual problem that I've been able
to isolate in the following:

  import ST

  three :: Int
  three = runST (do v<-newSTRef 0
		    writeSTRef v 3
		    readSTRef v)

  main = print (three*3)

when this is compiled and run using ghc, it prints

  carl@exp(monad) ./a.out
  <<ST action>>
  carl@exp(monad) 

what need I do to make it print 6?

Sincerely,
  Carl