From 8ff6b1aa96c728b6894892968479d50a1c78bfa7 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 8 Sep 2016 09:39:19 -0400 Subject: [PATCH] Use $! instead of seq. --- src/TreeSitter.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TreeSitter.hs b/src/TreeSitter.hs index 09a16d529..42f9a8073 100644 --- a/src/TreeSitter.hs +++ b/src/TreeSitter.hs @@ -49,7 +49,7 @@ documentToTerm language document blob = alloca $ \ root -> do , spanEnd = SourcePos (fromIntegral $! ts_node_p_end_point_row node) (fromIntegral $! ts_node_p_end_point_column node) } -- Note: The strict application here is semantically important. Without it, we may not evaluate the range until after we’ve exited the scope that `node` was allocated within, meaning `alloca` will free it & other stack data may overwrite it. - range `seq` termConstructor (source blob) (sourceSpan `seq` pure sourceSpan) (toS name) range (filter (\child -> category (extract child) /= Empty) children) + range `seq` termConstructor (source blob) (pure $! sourceSpan) (toS name) range (filter (\child -> category (extract child) /= Empty) children) getChild node n out = ts_node_p_named_child node n out >> toTerm out {-# INLINE getChild #-} termConstructor = case language of