Haskell loop until a key is pressed -


I run a program every n and refresh the screen (some lines) again I want to say I press the q key How to get it?

I have checked the ansi-terminal package to refresh some part of the screen. I am feeling that I should use the Hasklin to get the loop and the user key press. Am i right

If so, I can not find the function in Hankeline.

You can do this very simply, but with IO Monad threadDelay to Control.Concurrent .

  import control. Integrated Refresh Interface :: Int Refresh Interleave = 10000 - Action in Microsoft Refresh :: IO (Refresh) = Definition Main :: IO (Main) = Refresh Action Threaded Refresh Interval Main   

This structure With now, you can now exclude the keyboard through any library that gives you keyboard input. For example, with the hasceline, you can read the input with the getInputChar Compare it to your dropout character, and exit if necessary. But doing this directly in this way will make you unable to read the input while the thread sleeps with threadDelay . If your input library reads buffers, it may be fine - the operation of the program closes / breaks can only happen when the program is checked for input you need more than that, through your The solution itself can roll either suggested in the code forkIO , or in the form of a library that carry that hand to handle such a bit better.

As an interesting note of note, it has been solved very easily in my OpenCiv library by using parts of the Library that wrap up OpenCV's high-performance functionality. I just need this functionality only. Do not recommend pulling in that dependency, but it technically resolves your problem. If there is any interest then I will add this answer.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -