1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 07:25:44 +03:00

don't use Eff in toAST since it's just being called from IO.

This commit is contained in:
Patrick Thomson 2018-05-25 12:34:04 -04:00
parent b2aa29e6c6
commit 3e02366d14

View File

@ -54,7 +54,7 @@ runParser parser blobSource = unsafeUseAsCStringLen (sourceBytes blobSource) $
else do
TS.ts_tree_root_node_p treePtr rootPtr
ptr <- peek rootPtr
runM (fmap Succeeded (anaM toAST ptr))
Succeeded <$> anaM toAST ptr
bracket acquire release go)
-- | The semantics of @bracket before after handler@ are as follows:
@ -94,8 +94,8 @@ parseToAST (Milliseconds s) language Blob{..} = bracket' TS.ts_parser_new TS.ts_
Nothing <$ liftIO (TS.ts_parser_set_enabled parser (CBool 0))
toAST :: forall grammar effects . (Bounded grammar, Enum grammar, Member IO effects) => TS.Node -> Eff effects (Base (AST [] grammar) TS.Node)
toAST node@TS.Node{..} = liftIO $ do
toAST :: forall grammar effects . (Bounded grammar, Enum grammar) => TS.Node -> IO (Base (AST [] grammar) TS.Node)
toAST node@TS.Node{..} = do
let count = fromIntegral nodeChildCount
children <- allocaArray count $ \ childNodesPtr -> do
_ <- with nodeTSNode (\ nodePtr -> TS.ts_node_copy_child_nodes nodePtr childNodesPtr (fromIntegral count))