I am building a code to get an understanding, actually a Solitaire solver. I have a simple brute force implementation that uses the state monad, in fact, just to prove that I can use it (it only contains a count of each move). But now I want to use Unboxed Mutable arrays to record visited boards and thereby speed up the evaluation of paths when I get to the position of the board that has already been visited in a different way. It seems that the ST monad does not allow me to enter an implicit state, but I have to use ST (or IO) to access the Mutable array. Therefore, it seems to me that I should combine two Monads - State to stream state (actually including a Mutable array), and the other (ST) to get Mutable array functions.
100%, ST- - . , ... " ", , STRef. , .
STRef
ST IO, . ( STM, , .)
, , , . - List Monad Error, , . , .
... , ST. , ST .
, , , . , STRef.
ST , , State monad : ! ; , , , . , ST . StateT , , ST , , , .. , . , StateT .
ST
State
StateT
, ReaderT. , , .
ReaderT