From cd53269f96873f228e196cb6d22d101c5e4f50ed Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 30 Aug 2017 18:11:59 +0200 Subject: bugfix for hasLinearization in the Haskell binding --- src/runtime/haskell-bind/PGF2.hsc | 5 +++-- src/runtime/haskell-bind/PGF2/FFI.hs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/runtime/haskell-bind') diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc index a23982465..93158213f 100644 --- a/src/runtime/haskell-bind/PGF2.hsc +++ b/src/runtime/haskell-bind/PGF2.hsc @@ -580,8 +580,9 @@ parseWithOracle lang cat sent (predict,complete,literal) = -- | Returns True if there is a linearization defined for that function in that language hasLinearization :: Concr -> Fun -> Bool hasLinearization lang id = unsafePerformIO $ - withGuPool $ \pl -> - newUtf8CString id pl >>= pgf_has_linearization (concr lang) + withGuPool $ \pl -> do + res <- newUtf8CString id pl >>= pgf_has_linearization (concr lang) + return (res /= 0) -- | Linearizes an expression as a string in the language linearize :: Concr -> Expr -> String diff --git a/src/runtime/haskell-bind/PGF2/FFI.hs b/src/runtime/haskell-bind/PGF2/FFI.hs index d01084d62..7379aa723 100644 --- a/src/runtime/haskell-bind/PGF2/FFI.hs +++ b/src/runtime/haskell-bind/PGF2/FFI.hs @@ -192,7 +192,7 @@ foreign import ccall "pgf/pgf.h pgf_print_name" pgf_print_name :: Ptr PgfConcr -> CString -> IO CString foreign import ccall "pgf/pgf.h pgf_has_linearization" - pgf_has_linearization :: Ptr PgfConcr -> CString -> IO Bool + pgf_has_linearization :: Ptr PgfConcr -> CString -> IO CInt foreign import ccall "pgf/pgf.h pgf_linearize" pgf_linearize :: Ptr PgfConcr -> PgfExpr -> Ptr GuOut -> Ptr GuExn -> IO () -- cgit v1.2.3