2 Dec
2003
2 Dec
'03
1:40 p.m.
tis 2003-12-02 klockan 14.23 skrev Johannes Waldmann:
Martin Norbäck wrote:
main = do input <- readline "prompt> " ; handle input
but this only reads one line (and it gives a Maybe String) I wanted a (lazy) list of all input lines, where the user should have the usual line editing functions available.
What do you mean? Readline is for editing one line. If you want something like getting multiple lines until user presses ctrl-d or something you can do this: readlines :: IO [String] readlines = do input <- readline "" case input of Nothing -> return [] Just str -> do strs <- readlines return (str:strs) It won't be lazy though. Regards, Martin