ANNOUNCE: Helium, for learning Haskell

Andres Loeh andres@cs.uu.nl
Mon, 3 Feb 2003 13:56:38 +0100


--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

> Unfortunately, readline history and line-editing commands
> do not work at the /usr/local/bin/hi prompt.  
> One would think they would because before I had readline-dev installed
> Helium refused to build.  Oh well!

This can hopefully be fixed by applying the simple patch that I
have attached.

Directly after unpacking the .tar.gz archive, say

  patch -p0 < helium-1.0-readline.patch

I have not thoroughly tested it, but it should work ...

Best,
  Andres


--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Description: helium-1.0-readline.patch
Content-Disposition: attachment; filename="helium-1.0-readline.patch"

diff -Naur helium-1.0.old/heliumNT/src/Makefile.in helium-1.0/heliumNT/src/Makefile.in
--- helium-1.0.old/heliumNT/src/Makefile.in	2003-01-21 16:06:01.000000000 +0000
+++ helium-1.0/heliumNT/src/Makefile.in	2003-02-03 12:37:54.000000000 +0000
@@ -181,7 +181,7 @@
 
 hi: interpreter/Main.hs utils/OSSpecific.hs
 	# GHC HeliumInterpreter
-	$(HC) --make -iutils -o $(HELIUMBINDIR)/hi$(EXE) interpreter/Main.hs 
+	$(HC) --make -package util -iutils -o $(HELIUMBINDIR)/hi$(EXE) interpreter/Main.hs 
 	$(STRIP) $(HELIUMBINDIR)/hi$(EXE)
 
 # AG sources
diff -Naur helium-1.0.old/heliumNT/src/interpreter/Main.hs helium-1.0/heliumNT/src/interpreter/Main.hs
--- helium-1.0.old/heliumNT/src/interpreter/Main.hs	2003-01-17 11:48:35.000000000 +0000
+++ helium-1.0/heliumNT/src/interpreter/Main.hs	2003-02-03 12:39:00.000000000 +0000
@@ -6,6 +6,7 @@
 import Monad
 import Char
 import List
+import Readline
 import OSSpecific
 
 data State = 
@@ -44,6 +45,9 @@
             processSpecial ("l " ++ head args) initialState
         else
             return initialState
+
+    -- Initialize readline
+    initialize
             
     -- Enter read-eval-print loop            
     loop stateAfterLoad
@@ -52,9 +56,9 @@
 
 loop :: State -> IO State
 loop state = do
-    putStr (prompt state)
-    hFlush stdout
-    command' <- getLine
+    command'' <- readline (prompt state)
+    let command' = maybe ":q" id command''
+    addHistory command'
     let command = trim command'
     newState <- case command of
         (':':cmd:rest) -> 

--qMm9M+Fa2AknHoGS--