summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2010-05-01 07:29:41 +0000
committerkrasimir <krasimir@chalmers.se>2010-05-01 07:29:41 +0000
commit0f1cce53c6e46c7767ecba735b1449f507432c1d (patch)
tree00e7a0639433737b779c73f0706a31f199ccb11c
parent9e7b914c3c5384feed3981acae89afaa7402e92b (diff)
fixes in unStr,unInt,unDouble,isMeta
-rw-r--r--src/runtime/haskell/PGF/Expr.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/runtime/haskell/PGF/Expr.hs b/src/runtime/haskell/PGF/Expr.hs
index 25d04a621..057678c70 100644
--- a/src/runtime/haskell/PGF/Expr.hs
+++ b/src/runtime/haskell/PGF/Expr.hs
@@ -106,6 +106,8 @@ unApp = extract []
where
extract es (EFun f) = Just (f,es)
extract es (EApp e1 e2) = extract (e2:es) e1
+ extract es (ETyped e ty)= extract es e
+ extract es (EImplArg e) = extract es e
extract es _ = Nothing
-- | Constructs an expression from string literal
@@ -115,6 +117,8 @@ mkStr s = ELit (LStr s)
-- | Decomposes an expression into string literal
unStr :: Expr -> Maybe String
unStr (ELit (LStr s)) = Just s
+unStr (ETyped e ty) = unStr e
+unStr (EImplArg e) = unStr e
unStr _ = Nothing
-- | Constructs an expression from integer literal
@@ -124,6 +128,8 @@ mkInt i = ELit (LInt i)
-- | Decomposes an expression into integer literal
unInt :: Expr -> Maybe Int
unInt (ELit (LInt i)) = Just i
+unInt (ETyped e ty) = unInt e
+unInt (EImplArg e) = unInt e
unInt _ = Nothing
-- | Constructs an expression from real number literal
@@ -133,6 +139,8 @@ mkDouble f = ELit (LFlt f)
-- | Decomposes an expression into real number literal
unDouble :: Expr -> Maybe Double
unDouble (ELit (LFlt f)) = Just f
+unDouble (ETyped e ty) = unDouble e
+unDouble (EImplArg e) = unDouble e
unDouble _ = Nothing
-- | Constructs an expression which is meta variable
@@ -141,8 +149,10 @@ mkMeta = EMeta 0
-- | Checks whether an expression is a meta variable
isMeta :: Expr -> Bool
-isMeta (EMeta _) = True
-isMeta _ = False
+isMeta (EMeta _) = True
+isMeta (ETyped e ty) = isMeta e
+isMeta (EImplArg e) = isMeta e
+isMeta _ = False
-----------------------------------------------------
-- Parsing