<div dir="ltr"><div>MonadIO m => MonadIO (InputT m)<br>MonadException m => MonadException (InputT m)<br><br></div><div>MonadIO means you have access to liftIO. liftIO . evaluate . force $ mycode.<br></div><div>MonadException means that you have access to haskeline's exception catching mechanisms.<br><br>In System.Console.Haskeline.MonadException, you have the catch, catches, and handle functions which will allow you to catch IO exceptions (in combination with liftIO), and also a bracket which will just let you do arbitrary IO actions and clean up when you are done (or hit an exception).<br><br></div><div>>let mycode = undefined :: Handle -> IO () -- example code<br><br>runInputT _ (bracket (liftIO $ openFile "blah" ReadMode) (liftIO . hClose) (\fp -> liftIO . mycode $ fp))<br><br></div><div>Another way to use it might be<br><br>runInputT _ (liftIO $ mycode _) `catches` [Handler iohandler, Handler anotherhandler]<br></div><div> where<br></div><div> iohandler :: IOException -> IO ()<br> iohandler e = putStrLn "got io exception" >> return ()<br><br></div><div>Exceptions are always a pain, and so are transformers, but you get used to them.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 1, 2016 at 4:06 AM, Dennis Raddle <span dir="ltr"><<a href="mailto:dennis.raddle@gmail.com" target="_blank">dennis.raddle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm looking over haskeline. It looks like I have to modify some of my code that is in the IO monad right now. I use 'evaluate' in several places, and also 'evaluate $ force', to make sure that IO exceptions are encountered where I can catch them. Can I use 'evaluate' with InputT? I'm muddled headed about what to do. I guess I would lift 'evaluate' into the inner monad? I am not sure what those words mean. How would I catch IO exceptions?</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 28, 2016 at 5:35 PM, Dennis Raddle <span dir="ltr"><<a href="mailto:dennis.raddle@gmail.com" target="_blank">dennis.raddle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks. I'll install haskeline</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 28, 2016 at 5:05 PM, David McBride <span dir="ltr"><<a href="mailto:toad3k@gmail.com" target="_blank">toad3k@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You will have to use the haskeline library. FYI that is the library that makes ghci work.<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Jul 28, 2016 at 6:09 PM, Dennis Raddle <span dir="ltr"><<a href="mailto:dennis.raddle@gmail.com" target="_blank">dennis.raddle@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">I wrote a program first in Windows, where it works as expected, and now I'm using it in OS X and getting undesired behavior. <div><br></div><div>It reads lines from the terminal using the getLine function. In Windows (DOS, actually) the up and down arrows can be used to choose previously entered lines. However, this does not work in bash in OS X. </div><div><br></div><div>What do I need to get the history available via the arrow keys?</div><span><font color="#888888"><div><br></div><div>D</div><div><br></div></font></span></div>
<br></div></div>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>