Newbie ST/Monad Question
Marcin 'Qrczak' Kowalczyk
qrczak@knm.org.pl
24 Aug 2001 17:44:30 GMT
Fri, 24 Aug 2001 11:28:56 -0600, Carl McTague <mctague@one.net> pisze:
> 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>>
Are you sure? It prints 9 for me.
> what need I do to make it print 6?
Change one of 3's to 2 :-)
--
__("< Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK