diff options
| author | aarne <aarne@cs.chalmers.se> | 2008-10-10 15:53:17 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2008-10-10 15:53:17 +0000 |
| commit | 4e795bab9b0e5dfcad903eb4c9d0aa0a5dab6e94 (patch) | |
| tree | c9e63d27c7fdaa916534130dec161990240be555 /src/GF/Command/TreeOperations.hs | |
| parent | 917f417413c0181a0a3f41f2dd65abbc80f9edf6 (diff) | |
a first version of PGF.AbsCompute
Diffstat (limited to 'src/GF/Command/TreeOperations.hs')
| -rw-r--r-- | src/GF/Command/TreeOperations.hs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/GF/Command/TreeOperations.hs b/src/GF/Command/TreeOperations.hs index f05b8dec3..0ff6ac682 100644 --- a/src/GF/Command/TreeOperations.hs +++ b/src/GF/Command/TreeOperations.hs @@ -2,11 +2,10 @@ module GF.Command.TreeOperations ( treeOp, allTreeOps --typeCheck, - --compute ) where import GF.Compile.TypeCheck -import GF.Compile.AbsCompute +import PGF (compute) -- for conversions import PGF.Data @@ -18,13 +17,13 @@ import Data.List type TreeOp = [Tree] -> [Tree] -treeOp :: String -> Maybe TreeOp -treeOp f = fmap snd $ lookup f allTreeOps +treeOp :: PGF -> String -> Maybe TreeOp +treeOp pgf f = fmap snd $ lookup f $ allTreeOps pgf -allTreeOps :: [(String,(String,TreeOp))] -allTreeOps = [ +allTreeOps :: PGF -> [(String,(String,TreeOp))] +allTreeOps pgf = [ ("compute",("compute by using semantic definitions (def)", - id)), + map (compute pgf))), ("smallest",("sort trees from smallest to largest, in number of nodes", smallest)), ("typecheck",("type check and solve metavariables; reject if incorrect", @@ -34,9 +33,6 @@ allTreeOps = [ typeCheck :: PGF -> Tree -> (Tree,(Bool,[String])) typeCheck pgf t = (t,(True,[])) -compute :: PGF -> Tree -> Tree -compute pgf t = t - smallest :: [Tree] -> [Tree] smallest = sortBy (\t u -> compare (size t) (size u)) where size t = case t of |
