aboutsummaryrefslogtreecommitdiff
path: root/iclean.icl
diff options
context:
space:
mode:
authorCamil Staps2016-01-27 19:33:35 +0100
committerCamil Staps2016-01-27 19:33:35 +0100
commitdfc747cebe8cf366bf694e977aa5f591e01c9a53 (patch)
tree47c10c9a8482e51c19467c24f768c7d5f9898c24 /iclean.icl
parentUpdate Makefile (diff)
readline history
Diffstat (limited to 'iclean.icl')
-rw-r--r--iclean.icl14
1 files changed, 8 insertions, 6 deletions
diff --git a/iclean.icl b/iclean.icl
index 13e7f5e..6f7ff04 100644
--- a/iclean.icl
+++ b/iclean.icl
@@ -33,6 +33,7 @@ import ReadLine
// SETTINGS
temp_path :== "/tmp/"
temp_module :== "iclean"
+readline_history :== ".iclean_history"
// END SETTINGS
temp_file :== temp_path +++ temp_module +++ ".icl"
@@ -40,24 +41,25 @@ temp_file :== temp_path +++ temp_module +++ ".icl"
Start :: *World -> *World
Start w
# w = setReadLineName "iClean" w
+# w = usingHistory w
+# (_, w) = readHistory readline_history w
# w = loop w
+# (i, w) = writeHistory readline_history w
= w
where
- loop :: *World -> *World
+ loop :: !*World -> *World
loop w
- # (s,w) = readLine "λ. " True w
+ # (s,w) = readLine "λ. " False w
| isNothing s = print "\n" w
# s = fromJust s
- | s == "" = w
+ | s == "" = loop (print "Use Ctrl-D to exit\n" w)
+ # w = addHistory s w
# w = writemodule s w
# (r,w) = compile temp_path temp_module w
| r <> 0 = loop w
# w = run (temp_path +++ temp_module) w
= loop w
- toList :: String -> [Char]
- toList s = fromString s
-
print :: String *World -> *World
print s w
# (io,w) = stdio w