1
0
forked from GitHub/gf-core

in command 'ai' send the output through the pipe

This commit is contained in:
krasimir
2009-05-13 06:49:37 +00:00
parent fdba7d20ee
commit 2c68b1ba88

View File

@@ -600,18 +600,21 @@ allCommands cod env@(pgf, mos) = Map.fromList [
exec = \opts arg -> do exec = \opts arg -> do
case arg of case arg of
[Fun id []] -> case Map.lookup id (funs (abstract pgf)) 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 $$ Just (ty,def) -> return $ fromString $
if def == EEq [] render (text "fun" <+> text (prCId id) <+> colon <+> ppType 0 ty $$
then empty if def == EEq []
else text "def" <+> text (prCId id) <+> char '=' <+> ppExpr 0 def)) then empty
else text "def" <+> text (prCId id) <+> char '=' <+> ppExpr 0 def)
Nothing -> case Map.lookup id (cats (abstract pgf)) of Nothing -> case Map.lookup id (cats (abstract pgf)) of
Just hyps -> putStrLn (render (text "cat" <+> text (prCId id) <+> hsep (map ppHypo hyps) $$ Just hyps -> do return $ fromString $
space $$ render (text "cat" <+> text (prCId id) <+> hsep (map ppHypo hyps) $$
text "fun" <+> vcat [text (prCId fid) <+> colon <+> ppType 0 ty space $$
| (fid,ty) <- functionsToCat pgf id])) text "fun" <+> vcat [text (prCId fid) <+> colon <+> ppType 0 ty
Nothing -> putStrLn "unknown identifier" | (fid,ty) <- functionsToCat pgf id])
_ -> putStrLn "a single identifier is expected from the command" Nothing -> do putStrLn "unknown identifier"
return void return void
_ -> do putStrLn "a single identifier is expected from the command"
return void
}) })
] ]
where where