From b8a7e50107ecc5a5b9cd1dbad6460a5fb3fbbf67 Mon Sep 17 00:00:00 2001 From: krasimir Date: Thu, 17 Sep 2009 15:47:06 +0000 Subject: added pt -transfer --- src/GF/Command/TreeOperations.hs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/GF/Command/TreeOperations.hs') diff --git a/src/GF/Command/TreeOperations.hs b/src/GF/Command/TreeOperations.hs index 0489dd23f..73cef05b2 100644 --- a/src/GF/Command/TreeOperations.hs +++ b/src/GF/Command/TreeOperations.hs @@ -3,25 +3,25 @@ module GF.Command.TreeOperations ( allTreeOps ) where -import GF.Compile.TypeCheck import PGF import PGF.Data - import Data.List type TreeOp = [Expr] -> [Expr] -treeOp :: PGF -> String -> Maybe TreeOp +treeOp :: PGF -> String -> Maybe (Either TreeOp (CId -> TreeOp)) treeOp pgf f = fmap snd $ lookup f $ allTreeOps pgf -allTreeOps :: PGF -> [(String,(String,TreeOp))] +allTreeOps :: PGF -> [(String,(String,Either TreeOp (CId -> TreeOp)))] allTreeOps pgf = [ ("compute",("compute by using semantic definitions (def)", - map (compute pgf))), + Left $ map (compute pgf))), + ("transfer",("syntactic transfer by applying function and computing", + Right $ \f -> map (compute pgf . EApp (EFun f)))), ("paraphrase",("paraphrase by using semantic definitions (def)", - nub . concatMap (paraphrase pgf))), + Left $ nub . concatMap (paraphrase pgf))), ("smallest",("sort trees from smallest to largest, in number of nodes", - smallest)) + Left $ smallest)) ] smallest :: [Expr] -> [Expr] -- cgit v1.2.3