[Haskell-cafe] Combine `StateT` and `InputT` to maintain state on Ctrl-C interrupt

haskell at stefan-klinger.de haskell at stefan-klinger.de
Wed Aug 12 15:49:10 UTC 2015


On 2015-Aug-12, Tom Ellis wrote with possible deletions:
> On Wed, Aug 12, 2015 at 04:26:59PM +0200, haskell at stefan-klinger.de wrote:
> > Version two: `InputT` inside `StateT`
> > 
> > > main :: IO ()
> > > main = runInputT defaultSettings . noesc $ evalStateT repl 0
> 
> Instead of this, how about `hoist`ing noesc inside the StateT?

Hmmmm... like so?

> main = runInputT defaultSettings $ evalStateT (hoist noesc repl) 0

that behaves just the same way.  I need to do some reading before I
understand what that actually does...

> (I would have tried this myself but it would be too fiddly to reconstitute
> working code from your email.)

Sorry, I have taken extra care that my original posting actually
compiles.  I just save the message as `StateMwe.lhs` and compile...

But thanks for the suggestion!
Stefan


-- 
http://stefan-klinger.de                                      o/X
                                                              /\/
                                                                \


More information about the Haskell-Cafe mailing list