mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-18 16:51:51 +03:00
4f10bfcfd2
This is referred to in the documentation, so should be there
20 lines
494 B
Idris
20 lines
494 B
Idris
import Text.Readline
|
|
|
|
testComplete : String -> Int -> IO (Maybe String)
|
|
testComplete text 0 = pure $ Just "hamster"
|
|
testComplete text 1 = pure $ Just "bar"
|
|
testComplete text st = pure Nothing
|
|
|
|
loop : IO ()
|
|
loop = do Just x <- readline "> "
|
|
| Nothing => putStrLn "EOF"
|
|
putStrLn x
|
|
when (x /= "") $ addHistory x
|
|
if x /= "quit"
|
|
then loop
|
|
else putStrLn "Done"
|
|
|
|
main : IO ()
|
|
main = do setCompletionFn testComplete
|
|
loop
|