Given a nesting of transformers :: T2 of T1 of M0, how can I utilize :: T2 of M0, :: M2 ?
Here's an example: I am writing some function which requires reading, logging, and state. The definition:
gameRoutine :: WriterT [String] (ReaderT Env (State Viable)) NUM
If I want to call some
stateFunction :: State Viable NUM
Or even stateWithReaderFunction :: ReaderT Env (State Viable) NUM,
I can use lift:
gameRoutine = do
x <- lift . lift $ stateFunction
y <- lift $ stateWithReaderFunction
But how do I call writerFunction :: Writer [String] a ?
How do I call writerStateFunction :: WriterT [String] (State Viable) NUM (the difference between gameRoutine definition is ReaderT layer missing)?
Clearly I don't want to lift their definitions to one of gameRoutine.