Encapsulation: The ST Monad
newSTRef :: a -> ST s (STRef s a)
readSTRef :: STRef s a -> ST s a
writeSTRef :: STRef s a -> a -> ST s ()
The encapsulation function:
runST :: (forall s . ST s a) -> a
The argument of runST
must be polymorphic in s.
This is a “rank 2” type.
Cannot be inferred --
must be declared.
Föregående bild
Nästa bild
Tillbaka till första bilden
Visa grafisk version