“readline” (or “haskeline”) for Curry?

寵の児 提交于 2019-12-11 02:48:47

问题


What's the most practical way to write a program in Curry programming language that would have a console UI with decent line editing?

Actually, I need to pass a string as a suggestion for the user's input, then let the user edit it in the console, and receive his edited variant back, process it (w.r.t. to the current state of the process), then loop.

I like readline-like/haskeline-like editing. (And BTW haskeline in its latest version (0.6.4.0) has exactly the API for what I want: read a line with a suggested initial value -- getInputLineWithInitial:

This function behaves in the exact same manner as getInputLine, except that it pre-populates the input area. The text that resides in the input area is given as a 2-tuple with two Strings. The string on the left of the tuple is what will appear to the left of the cursor and the string on the right is what will appear to the right of the cursor.

)

How to get the wanted functionality for a Curry program in the most practical way (I mean, I'd like not to write new code in Curry for the console editing operations, but rather perhaps use a library, or a wrapper, or FFI)?

来源:https://stackoverflow.com/questions/5737170/readline-or-haskeline-for-curry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!