safer memory management in the Haskell binding

This commit is contained in:
krasimir
2017-02-10 17:10:37 +00:00
parent d0f7f9ca8d
commit 94f41cc63d
5 changed files with 94 additions and 66 deletions

View File

@@ -10,10 +10,12 @@ import Control.Exception
import GHC.Ptr
import Data.Int(Int32)
type Touch = IO ()
-- | An abstract data type representing multilingual grammar
-- in Portable Grammar Format.
data PGF = PGF {pgf :: Ptr PgfPGF, pgfMaster :: ForeignPtr GuPool}
data Concr = Concr {concr :: Ptr PgfConcr, concrMaster :: PGF}
data PGF = PGF {pgf :: Ptr PgfPGF, touchPGF :: Touch}
data Concr = Concr {concr :: Ptr PgfConcr, touchConcr :: Touch}
------------------------------------------------------------------
-- libgu API