funcons-tools 0.2.0.10 → 0.2.0.11
raw patch · 3 files changed
+18/−18 lines, 3 filesdep +haskelinedep +transformersdep −funcons-toolsdep −readline
Dependencies added: haskeline, transformers
Dependencies removed: funcons-tools, readline
Files
- funcons-tools.cabal +4/−4
- src/Funcons/Explorer.hs +10/−10
- src/Funcons/Simulation.hs +4/−4
funcons-tools.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: funcons-tools-version: 0.2.0.10+version: 0.2.0.11 synopsis: A modular interpreter for executing funcons description: The PLanCompS project (<http://plancomps.org>) has developed a component-based approach to formal semantics.@@ -57,7 +57,7 @@ ,regex-applicative ,random-strings ,funcons-values >= 0.1.0.5- ,readline >= 1.0.3.0+ ,haskeline >= 0.8.1.2 hs-source-dirs: src, cbs, manual default-language: Haskell2010 other-extensions: OverloadedStrings@@ -145,7 +145,6 @@ ,containers >= 0.5 && < 0.7 ,vector>=0.12 ,bv >= 0.5- ,funcons-tools ,multiset >= 0.3 ,split ,directory@@ -156,7 +155,8 @@ ,random-strings ,funcons-values >= 0.1.0.5 ,exploring-interpreters >= 0.3.0.0- ,readline >= 1.0.3.0+ ,haskeline >= 0.8.1+ ,transformers >= 0.5.6 hs-source-dirs: src, manual, cbs default-language: Haskell2010 -- ghc-options: -rtsopts
src/Funcons/Explorer.hs view
@@ -23,7 +23,9 @@ import Data.Tree (drawTree) import Text.Read (readMaybe) -import System.Console.Readline+import Control.Monad.Trans.Class (lift) +import System.Console.Haskeline+import System.Console.Haskeline.History import System.Environment import System.IO @@ -42,24 +44,22 @@ Nothing -> putStrLn "Invalid reference for revert" >> return exp repl :: IO ()-repl = getArgs >>= mk_explorer >>= repl'+repl = getArgs >>= mk_explorer >>= (runInputT defaultSettings . repl') where repl' exp = do- hFlush stdout- readline ("#" ++ show (EI.currRef exp) ++ " > ") >>= \case + getInputLine ("#" ++ show (EI.currRef exp) ++ " > ") >>= \case Nothing -> return () Just input -> do- addHistory input case break isSpace input of (":session", _) -> do- (putStrLn . drawTree . fmap (show . fst) . EI.toTree) exp+ (outputStrLn . drawTree . fmap (show . fst) . EI.toTree) exp repl' exp (":revert", mint) | Just ref_id' <- readMaybe (dropWhile isSpace mint)- -> handle_revert ref_id' exp >>= repl'- | otherwise -> putStrLn "Revert requires an integer argument" >> repl' exp+ -> lift (handle_revert ref_id' exp) >>= repl'+ | otherwise -> outputStrLn "Revert requires an integer argument" >> repl' exp _ -> case fct_parse_either input of - Left err -> putStrLn err >> repl' exp - Right fct -> EI.execute fct exp >>= (repl' . fst)+ Left err -> outputStrLn err >> repl' exp + Right fct -> lift (EI.execute fct exp) >>= (repl' . fst) mk_explorer :: [String] -> IO Explorer
src/Funcons/Simulation.hs view
@@ -10,7 +10,7 @@ import Control.Applicative import Control.Monad.State-import System.Console.Readline+import System.Console.Haskeline import qualified Data.Map as M import Data.Text (unpack) @@ -22,10 +22,10 @@ instance Interactive IO where fexec ma _ = (,M.empty) <$> ma - fread str_inp nm = do- mLine <- readline prompt + fread str_inp nm = runInputT defaultSettings $ do+ mLine <- getInputLine prompt case mLine of Nothing -> return (string_ "")- Just s -> addHistory s >> return (toFuncon s)+ Just s -> return (toFuncon s) where toFuncon str | str_inp = string_ str | otherwise = fvalue_parse str prompt | nm == "standard-in" = "\n> "