Closed jerbaroo closed 7 years ago
Seems right to me, I don't think that there is anything wrong with the way you wrote it.
That said, using a ReaderT
monad or other monad stack on top of UI
is probably less useful than one might think. The problem is that any event handler, which you may attach to, say, a button, still needs to be in the UI
monad. It's easier to use a parameter or a mutable variable in this case.
People will perhaps want to use some state or read-only config, or other functionality and hence want to use
StateT
,ReaderT
, or some other monad transformers.An attempt using
ReaderT
is shown below, however the use oflift
is not very nice. Perhaps I'm approaching it wrong.A sample showing how to use a custom monad stack could be quite helpful.
Based on feedback I could send in a PR.