summaryrefslogtreecommitdiff
path: root/src/runtime/haskell-bind/examples
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/haskell-bind/examples')
-rw-r--r--src/runtime/haskell-bind/examples/pgf-shell.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/runtime/haskell-bind/examples/pgf-shell.hs b/src/runtime/haskell-bind/examples/pgf-shell.hs
index e111076d4..bb15508c7 100644
--- a/src/runtime/haskell-bind/examples/pgf-shell.hs
+++ b/src/runtime/haskell-bind/examples/pgf-shell.hs
@@ -34,10 +34,14 @@ execute pgf cmd =
L lang tree -> do c <- getConcr' pgf lang
putStrLn $ linearize c tree
P lang s -> do c <- getConcr' pgf lang
- printl $ parse c (startCat pgf) s
+ case parse c (startCat pgf) s of
+ Left tok -> putStrLn ("parse error: "++tok)
+ Right ts -> printl ts
T from to s -> do cfrom <- getConcr' pgf from
cto <- getConcr' pgf to
- putl [linearize cto t|(t,_)<-parse cfrom (startCat pgf) s]
+ putl [linearize cto t|(t,_)<-case parse cfrom (startCat pgf) s of
+ Left _ -> []
+ Right ts -> ts]
_ -> putStrLn "Huh?"
`catch` print