30 May
2007
30 May
'07
11:18 a.m.
Hi Frederico, I had the exact same problem when I first started with Haskell. Quite simply, State uses get/put to handle passing state, whereas ST uses STRefs and STArrays. In State s a, the s has meaning, for example it could be a random number generator or key-value mapping you want to pass around. However in ST s a, the s only exists in the type. The actual state is stored in references and arrays. Perhaps someone more knowledgeable should add something to the Haddock comments; I think this confuses a lot of people at first. Joel