From 96594e405dc88fda397733ae8b51bfdf542be09f Mon Sep 17 00:00:00 2001 From: hallgren Date: Fri, 7 Feb 2014 16:40:13 +0000 Subject: [PATCH] pgf-shell: show the names of the concrete syntaxes after loading the grammar --- src/runtime/haskell-bind/examples/pgf-shell.hs | 8 +++++--- src/runtime/haskell-bind/haskell-bind.cabal | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/runtime/haskell-bind/examples/pgf-shell.hs b/src/runtime/haskell-bind/examples/pgf-shell.hs index 224c16512..fbb4c4023 100644 --- a/src/runtime/haskell-bind/examples/pgf-shell.hs +++ b/src/runtime/haskell-bind/examples/pgf-shell.hs @@ -9,6 +9,7 @@ import Control.Monad(forever) import Data.Char(isSpace) +import qualified Data.Map as M import System.IO(hFlush,stdout) import System.IO.Error(catchIOError) import System.Environment @@ -22,9 +23,10 @@ getPGF [path] = pgfShell =<< readPGF path getPGF _ = putStrLn "Usage: pgf-shell " pgfShell pgf = - forever $ do performGC - putStr "> "; hFlush stdout - execute pgf =<< readLn + do putStrLn . unwords . map (show.fst) . M.toList $ languages pgf + forever $ do performGC + putStr "> "; hFlush stdout + execute pgf =<< readLn execute pgf cmd = case cmd of diff --git a/src/runtime/haskell-bind/haskell-bind.cabal b/src/runtime/haskell-bind/haskell-bind.cabal index 31f2a75d2..863bd3da8 100644 --- a/src/runtime/haskell-bind/haskell-bind.cabal +++ b/src/runtime/haskell-bind/haskell-bind.cabal @@ -19,7 +19,8 @@ cabal-version: >=1.10 library exposed-modules: CId, CRuntimeFFI other-modules: Gu, PgfLow - build-depends: base >=4.5 && <4.7, bytestring >=0.9 && <0.11, pretty >=1.1 && <1.2 + build-depends: base >=4.5 && <4.7, bytestring >=0.9 && <0.11, + pretty >=1.1 && <1.2, containers -- hs-source-dirs: build-tools: hsc2hs extra-libraries: gu pgf @@ -29,7 +30,7 @@ library executable pgf-shell main-is: pgf-shell.hs hs-source-dirs: examples - build-depends: base, haskell-bind + build-depends: base, haskell-bind, containers default-language: Haskell2010 if impl(ghc>=7.0) ghc-options: -rtsopts