summaryrefslogtreecommitdiff
path: root/src/GF
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-05-13 06:49:37 +0000
committerkrasimir <krasimir@chalmers.se>2009-05-13 06:49:37 +0000
commit2c68b1ba883b3c8b3384375d0caebe0fa48e5ba6 (patch)
treece3161f8633218f4b3be2972a15a60b9eba179e7 /src/GF
parentfdba7d20eee5a10f15a77f2140a8f6ffd31a9e67 (diff)
in command 'ai' send the output through the pipe
Diffstat (limited to 'src/GF')
-rw-r--r--src/GF/Command/Commands.hs25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/GF/Command/Commands.hs b/src/GF/Command/Commands.hs
index 6891b45b0..fff9e011d 100644
--- a/src/GF/Command/Commands.hs
+++ b/src/GF/Command/Commands.hs
@@ -600,18 +600,21 @@ allCommands cod env@(pgf, mos) = Map.fromList [
exec = \opts arg -> do
case arg of
[Fun id []] -> case Map.lookup id (funs (abstract pgf)) of
- Just (ty,def) -> putStrLn (render (text "fun" <+> text (prCId id) <+> colon <+> ppType 0 ty $$
- if def == EEq []
- then empty
- else text "def" <+> text (prCId id) <+> char '=' <+> ppExpr 0 def))
+ Just (ty,def) -> return $ fromString $
+ render (text "fun" <+> text (prCId id) <+> colon <+> ppType 0 ty $$
+ if def == EEq []
+ then empty
+ else text "def" <+> text (prCId id) <+> char '=' <+> ppExpr 0 def)
Nothing -> case Map.lookup id (cats (abstract pgf)) of
- Just hyps -> putStrLn (render (text "cat" <+> text (prCId id) <+> hsep (map ppHypo hyps) $$
- space $$
- text "fun" <+> vcat [text (prCId fid) <+> colon <+> ppType 0 ty
- | (fid,ty) <- functionsToCat pgf id]))
- Nothing -> putStrLn "unknown identifier"
- _ -> putStrLn "a single identifier is expected from the command"
- return void
+ Just hyps -> do return $ fromString $
+ render (text "cat" <+> text (prCId id) <+> hsep (map ppHypo hyps) $$
+ space $$
+ text "fun" <+> vcat [text (prCId fid) <+> colon <+> ppType 0 ty
+ | (fid,ty) <- functionsToCat pgf id])
+ Nothing -> do putStrLn "unknown identifier"
+ return void
+ _ -> do putStrLn "a single identifier is expected from the command"
+ return void
})
]
where