From b227c8a586d358e41b535517e4e423fd302ef6bf Mon Sep 17 00:00:00 2001 From: krasimir Date: Sat, 31 Jul 2010 12:52:20 +0000 Subject: [PATCH] now the meta id of the meta variables is accessible via the PGF API --- src/runtime/haskell/PGF.hs | 2 +- src/runtime/haskell/PGF/Expr.hs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/runtime/haskell/PGF.hs b/src/runtime/haskell/PGF.hs index c387521a7..652399f69 100644 --- a/src/runtime/haskell/PGF.hs +++ b/src/runtime/haskell/PGF.hs @@ -47,7 +47,7 @@ module PGF( mkStr, unStr, mkInt, unInt, mkDouble, unDouble, - mkMeta, isMeta, + mkMeta, unMeta, -- * Operations -- ** Linearization diff --git a/src/runtime/haskell/PGF/Expr.hs b/src/runtime/haskell/PGF/Expr.hs index 057678c70..2202a20c4 100644 --- a/src/runtime/haskell/PGF/Expr.hs +++ b/src/runtime/haskell/PGF/Expr.hs @@ -5,7 +5,7 @@ module PGF.Expr(Tree, BindType(..), Expr(..), Literal(..), Patt(..), Equation(.. mkStr, unStr, mkInt, unInt, mkDouble, unDouble, - mkMeta, isMeta, + mkMeta, unMeta, normalForm, @@ -144,15 +144,15 @@ unDouble (EImplArg e) = unDouble e unDouble _ = Nothing -- | Constructs an expression which is meta variable -mkMeta :: Expr -mkMeta = EMeta 0 +mkMeta :: Int -> Expr +mkMeta i = EMeta i -- | Checks whether an expression is a meta variable -isMeta :: Expr -> Bool -isMeta (EMeta _) = True -isMeta (ETyped e ty) = isMeta e -isMeta (EImplArg e) = isMeta e -isMeta _ = False +unMeta :: Expr -> Maybe Int +unMeta (EMeta i) = Just i +unMeta (ETyped e ty) = unMeta e +unMeta (EImplArg e) = unMeta e +unMeta _ = Nothing ----------------------------------------------------- -- Parsing