From 038d0b6ff68562a90a421bfc9a40d82bd5ae7f2b Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 23 Dec 2015 10:34:08 -0500 Subject: [PATCH] Implement the Storable instance for TSNode in terms of its CStorable instance. --- src/TreeSitter.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TreeSitter.hs b/src/TreeSitter.hs index fe51c338f..58db07763 100644 --- a/src/TreeSitter.hs +++ b/src/TreeSitter.hs @@ -26,10 +26,10 @@ data TSNode = TsNode { _data :: Ptr (), offset0 :: CSize, offset1 :: CSize, offs instance CStorable TSNode instance Storable TSNode where - alignment _ = 32 - sizeOf _ = 32 - peek _ = error "Haskell code should never read TSNode values directly." - poke _ _ = error "Haskell code should never write TSNode values directly." + alignment = cAlignment + sizeOf = cSizeOf + peek = cPeek + poke = cPoke foreign import ccall "app/bridge.h ts_document_root_node_p" ts_document_root_node_p :: Ptr TSDocument -> Ptr TSNode -> IO () foreign import ccall "app/bridge.h ts_node_p_name" ts_node_p_name :: Ptr TSNode -> Ptr TSDocument -> IO CString