forked from GitHub/gf-core
instance Eq Expr in the Haskell binding
This commit is contained in:
@@ -1037,7 +1037,7 @@ pgf_literal_eq(PgfLiteral lit1, PgfLiteral lit2)
|
||||
return false;
|
||||
}
|
||||
|
||||
PGF_API bool
|
||||
PGF_API int
|
||||
pgf_expr_eq(PgfExpr e1, PgfExpr e2)
|
||||
{
|
||||
GuVariantInfo ei1 = gu_variant_open(e1);
|
||||
|
||||
@@ -185,7 +185,7 @@ pgf_read_type(GuIn* in, GuPool* pool, GuExn* err);
|
||||
PGF_API_DECL bool
|
||||
pgf_literal_eq(PgfLiteral lit1, PgfLiteral lit2);
|
||||
|
||||
PGF_API_DECL bool
|
||||
PGF_API_DECL int
|
||||
pgf_expr_eq(PgfExpr e1, PgfExpr e2);
|
||||
|
||||
PGF_API_DECL bool
|
||||
|
||||
@@ -34,6 +34,13 @@ data Expr = Expr {expr :: PgfExpr, touchExpr :: Touch}
|
||||
instance Show Expr where
|
||||
show = showExpr []
|
||||
|
||||
instance Eq Expr where
|
||||
(Expr e1 e1_touch) == (Expr e2 e2_touch) =
|
||||
unsafePerformIO $ do
|
||||
res <- pgf_expr_eq e1 e2
|
||||
e1_touch >> e2_touch
|
||||
return (res /= 0)
|
||||
|
||||
-- | Constructs an expression by lambda abstraction
|
||||
mkAbs :: BindType -> CId -> Expr -> Expr
|
||||
mkAbs bind_type var (Expr body bodyTouch) =
|
||||
|
||||
Reference in New Issue
Block a user