I want to run randomIO
inside my StateT a STM b
but I get this error:
Expected type: StateT Session STM Float
Actual type: IO Float
so I try lift
'ing from Control.Monad.Trans.Class
(re-exported by State's Strict module):
Expected type: StateT Session STM Float
Actual type: StateT Session IO Float
which is closer but not quite there. I can't liftIO
because there's no MonadIO
instance for STM
.
How can I get this to compile so I can run randomIO
inside STM
inside my StateT
?
As per the comments I was attempting something stupid. Instead I passed a list of random Float
s that I needed to my function using randomRs (0.0, 1.0) g
.