aboutsummaryrefslogtreecommitdiff
path: root/iclean.icl
diff options
context:
space:
mode:
authorCamil Staps2016-01-27 17:38:10 +0100
committerCamil Staps2016-01-27 17:38:10 +0100
commita087340766ef63a8cf13f0391929c00cab0f5319 (patch)
tree7dc13ee95a1f8a4164f921c545b7c7551bb9f903 /iclean.icl
parentCleanup, removed warnings, newline at end session (diff)
Using CleanReadLine
Diffstat (limited to 'iclean.icl')
-rw-r--r--iclean.icl19
1 files changed, 6 insertions, 13 deletions
diff --git a/iclean.icl b/iclean.icl
index f72d349..84f0dc5 100644
--- a/iclean.icl
+++ b/iclean.icl
@@ -28,6 +28,7 @@
module iclean
import StdEnv
+import ReadLine
// SETTINGS
temp_path :== "/tmp/"
@@ -38,13 +39,13 @@ temp_file :== temp_path +++ temp_module +++ ".icl"
Start :: *World -> *World
Start w
+# w = setReadLineName "iClean" w
# w = loop w
= w
where
loop :: *World -> *World
loop w
- # w = print "λ. " w
- # (s,w) = readline w
+ # (s,w) = readLine "λ. " True w
| s == "" = print "\n" w
# w = writemodule s w
# (r,w) = compile temp_path temp_module w
@@ -52,6 +53,9 @@ where
# 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
@@ -60,17 +64,6 @@ print s w
| not ok = abort "Couldn't close stdio\n"
| otherwise = w
-readline :: *World -> *(String,*World)
-readline w
-# (io,w) = stdio w
-# (s,io) = freadline io
-# (ok,w) = fclose io w
-| not ok = abort "Couldn't close stdio\n"
-| otherwise = (s % (0,length (l s) - 2), w)
-where
- l :: String -> [Char]
- l s = fromString s
-
writemodule :: String *World -> *World
writemodule s w
# (ok,f,w) = fopen temp_file FWriteText w