问题
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