
Tom Ellis
On Wed, Aug 12, 2015 at 04:26:59PM +0200, haskell@stefan-klinger.de wrote:
At first I thought I had stacked the `StateT` and `InputT` in the wrong order. But changing from `InputT (StateT Int IO) ()` to `StateT Int (InputT IO) ()` seems not to change anything (which really gives me the creeps).
InputT is essentially ReaderT
http://hackage.haskell.org/package/haskeline-0.7.2.1/docs/src/System-Console...
so it's not surprising that the order has no effect. Reader commutes with State.
Note in the source there that the state of the Haskeline stuff itself uses "ReaderT (IO _) vs StateT so that exceptions (e.g. ctrl-c) don't cause us to lose the existing state." If there was a more elegant solution, Haskeline itself could use it, I guess? So it's probably at least hard to do generally for any exception occurring in the application? But could one get away with using `handle` at the particular sites where one expects to be interrupted, e.g. around the call to `threadDelay`?