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

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Wed Aug 12 16:02:37 UTC 2015


On Wed, Aug 12, 2015 at 05:49:10PM +0200, haskell at stefan-klinger.de wrote:
> 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 was what I was thinking.

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

I think it's probably a dead end then.  In fact it may well be doing exactly
what you were doing before in longhand.

> > (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...

Good idea.  I didn't think of lhs.  My fault, not yours!

Tom


More information about the Haskell-Cafe mailing list