From 71c4b4a24640a0bc593527660bda16f61e729cc0 Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Mon, 4 Sep 2017 14:49:44 +0200 Subject: instance Eq Expr in the Haskell binding --- src/runtime/haskell-bind/PGF2/Expr.hsc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/runtime/haskell-bind') diff --git a/src/runtime/haskell-bind/PGF2/Expr.hsc b/src/runtime/haskell-bind/PGF2/Expr.hsc index af3afeef5..a03a24be3 100644 --- a/src/runtime/haskell-bind/PGF2/Expr.hsc +++ b/src/runtime/haskell-bind/PGF2/Expr.hsc @@ -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) = -- cgit v1.2.3