summaryrefslogtreecommitdiff
path: root/src/runtime/haskell-bind/PGF2.hsc
diff options
context:
space:
mode:
authorKrasimir Angelov <kr.angelov@gmail.com>2017-09-05 09:46:43 +0200
committerKrasimir Angelov <kr.angelov@gmail.com>2017-09-05 09:46:43 +0200
commita5fe5b9378937a35fa7921c6ed62ec9efa059934 (patch)
treebf11774a2b8777ca3a9f9d2c59599ad18d1cf82e /src/runtime/haskell-bind/PGF2.hsc
parent08d781833cbe2474d12a54e059eebd6aa139d800 (diff)
added exprHash in the Haskell binding
Diffstat (limited to 'src/runtime/haskell-bind/PGF2.hsc')
-rw-r--r--src/runtime/haskell-bind/PGF2.hsc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc
index 037145ee6..f2f1b4113 100644
--- a/src/runtime/haskell-bind/PGF2.hsc
+++ b/src/runtime/haskell-bind/PGF2.hsc
@@ -39,6 +39,7 @@ module PGF2 (-- * PGF
mkFloat,unFloat,
mkMeta,unMeta,
mkCId,
+ exprHash,
treeProbability,
-- ** Types
@@ -323,6 +324,15 @@ treeProbability (PGF p _) (Expr c_expr touch1) =
touch1
return (realToFrac res)
+exprHash :: Int32 -> Expr -> Int32
+exprHash h (Expr c_expr touch1) =
+ unsafePerformIO $ do
+ h <- pgf_expr_hash (fromIntegral h) c_expr
+ touch1
+ return (fromIntegral h)
+
+
+
-----------------------------------------------------------------------------
-- Graphviz