From 01a8e1b88f190a6170512efd303981e98b4b3134 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Tue, 5 Sep 2017 10:29:02 +0200 Subject: GF.Command.TreeOperations is now independent from the runtime's internals --- src/runtime/haskell/PGF.hs | 2 +- src/runtime/haskell/PGF/Expr.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/runtime/haskell') diff --git a/src/runtime/haskell/PGF.hs b/src/runtime/haskell/PGF.hs index 1c425a565..83d9102c3 100644 --- a/src/runtime/haskell/PGF.hs +++ b/src/runtime/haskell/PGF.hs @@ -47,7 +47,7 @@ module PGF( Expr, showExpr, readExpr, mkAbs, unAbs, - mkApp, unApp, + mkApp, unApp, unapply, mkStr, unStr, mkInt, unInt, mkDouble, unDouble, diff --git a/src/runtime/haskell/PGF/Expr.hs b/src/runtime/haskell/PGF/Expr.hs index 331a69d90..d015f18e0 100644 --- a/src/runtime/haskell/PGF/Expr.hs +++ b/src/runtime/haskell/PGF/Expr.hs @@ -2,7 +2,7 @@ module PGF.Expr(Tree, BindType(..), Expr(..), Literal(..), Patt(..), Equation(.. readExpr, showExpr, pExpr, pBinds, ppExpr, ppPatt, pattScope, mkAbs, unAbs, - mkApp, unApp, unAppForm, + mkApp, unApp, unapply, mkStr, unStr, mkInt, unInt, mkDouble, unDouble, @@ -108,13 +108,13 @@ mkApp f es = foldl EApp (EFun f) es -- | Decomposes an expression into application of function unApp :: Expr -> Maybe (CId,[Expr]) -unApp e = case unAppForm e of +unApp e = case unapply e of (EFun f,es) -> Just (f,es) _ -> Nothing -- | Decomposes an expression into an application of a constructor such as a constant or a metavariable -unAppForm :: Expr -> (Expr,[Expr]) -unAppForm = extract [] +unapply :: Expr -> (Expr,[Expr]) +unapply = extract [] where extract es f@(EFun _) = (f,es) extract es (EApp e1 e2) = extract (e2:es) e1 -- cgit v1.2.3