packages feed

djinn 2009.9.3 → 2011.7.23

raw patch · 4 files changed

+27/−7 lines, 4 filesdep +haskelinedep −editlinedep ~base

Dependencies added: haskeline

Dependencies removed: editline

Dependency ranges changed: base

Files

djinn.cabal view
@@ -1,5 +1,5 @@ Name:		djinn-Version:	2009.9.3+Version:	2011.7.23 License:	BSD3 License-file:	LICENSE Author:		Lennart Augustsson@@ -10,7 +10,7 @@ Homepage:	http://www.augustsson.net/Darcs/Djinn/ Synopsis:	Generate Haskell code from a type Build-type:	Simple-Build-Depends:	base >= 3 && < 4, mtl, editline -any, pretty, array, containers+Build-Depends:	base >= 4 && < 5, mtl, haskeline -any, pretty, array, containers  Executable:     djinn Main-Is:        Djinn.hs
src/Djinn.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-unused-do-bind #-} -- -- Copyright (c) 2005 Lennart Augustsson -- See LICENSE for licensing details.@@ -9,7 +10,6 @@ import Text.ParserCombinators.ReadP import Control.Monad(when) import Control.Monad.Error()-import System.IO import System.Exit import System.Environment @@ -22,7 +22,7 @@ --import Debug.Trace  version :: String-version = "version 2009-09-04"+version = "version 2011-07-23"  main :: IO () main = do
src/HTypes.hs view
@@ -1,3 +1,4 @@+{-# OPTIONS_GHC -fno-warn-unused-do-bind #-} -- -- Copyright (c) 2005 Lennart Augustsson -- See LICENSE for licensing details.
src/REPL.hs view
@@ -3,11 +3,11 @@ -- See LICENSE for licensing details. -- module REPL(REPL(..), repl) where-import qualified Control.Exception-import System.Console.Editline.Readline(readline, addHistory)+import Control.Monad.Trans+import System.Console.Haskeline  data REPL s = REPL {-    repl_init :: IO (String, s),                -- prompt and initial state+    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 ()     }@@ -15,6 +15,24 @@ repl :: REPL s -> IO () repl p = do     (prompt, state) <- repl_init p+    let loop s = do+            mline <- getInputLine prompt+            case mline of+                Nothing -> loop s+                Just line -> do+                     (quit, s') <- liftIO $ repl_eval p s line+                     if quit then+                         liftIO $ repl_exit p s'+                      else+                         loop s'+    runInputT defaultSettings (loop state)++++{-+repl :: REPL s -> IO ()+repl p = do+    (prompt, state) <- repl_init p     let loop s = (do             mline <- readline prompt             case mline of@@ -32,3 +50,4 @@                     loop s             )     loop state+-}