lambdacube 2008.12.24 → 2008.12.25
raw patch · 4 files changed
+63/−2 lines, 4 files
Files
- Makefile +19/−0
- REPL.hs +34/−0
- lambdacube.cabal +4/−2
- test.ok +6/−0
+ Makefile view
@@ -0,0 +1,19 @@+GHC= ghc++.PHONY: all+all: cube++cube: Cube.hs CubeExpr.hs+ $(GHC) --make -Wall Cube.hs -o cube++CUBES= misc.cube bool.cube pair.cube maybe.cube either.cube nat.cube natmisc.cube \+ list.cube listmisc.cube unit.cube void.cube exists.cube++.PHONY: test+test: $(CUBES)+ cube - $(CUBES) test.cube > test.out+ cmp test.ok test.out && echo Test OK++.PHONY: clean+clean:+ rm -rf *.o *.hi *~ cube setup dist test.out
+ REPL.hs view
@@ -0,0 +1,34 @@+--+-- Copyright (c) 2005 Lennart Augustsson+-- See LICENSE for licensing details.+--+module REPL(REPL(..), repl) where+import qualified Control.Exception+import System.Console.Editline.Readline(readline, addHistory)++data REPL s = REPL {+ repl_init :: IO (String, s), -- prompt and initial state+ repl_eval :: s -> String -> IO (Bool, s), -- quit flag and new state+ repl_exit :: s -> IO ()+ }++repl :: REPL s -> IO ()+repl p = do+ (prompt, state) <- repl_init p+ let loop s = (do+ mline <- readline prompt+ case mline of+ Nothing -> loop s+ Just line -> do+ (quit, s') <- repl_eval p s line+ if quit then+ repl_exit p s'+ else do+ addHistory line+ loop s'+ ) `Control.Exception.catch` ( \ exc ->+ do+ putStrLn $ "\nInterrupted (" ++ show exc ++ ")"+ loop s+ )+ loop state
lambdacube.cabal view
@@ -1,5 +1,5 @@ Name: lambdacube-Version: 2008.12.24+Version: 2008.12.25 License: BSD3 License-file: LICENSE Author: Lennart Augustsson <lennart@augustsson.net>@@ -10,6 +10,8 @@ Build-Depends: base, pretty, mtl, editline Build-Type: Simple Extra-source-files:+ Makefile+ test.ok bool.cube char.cube either.cube@@ -28,5 +30,5 @@ Executable: cube Main-Is: Cube.hs-Other-modules: CubeExpr+Other-modules: CubeExpr REPL
+ test.ok view
@@ -0,0 +1,6 @@+Type:+forall (Char :: *) .+ Char->forall (listT :: *) . listT->(Char->listT->listT)->listT+Value:+\ (Char :: *) ('b' :: Char) (listT :: *) (nil :: listT)+ (cons :: Char->listT->listT) -> cons 'b' (cons 'b' (cons 'b' nil))