diff --git a/semantic-ast/src/Main.hs b/semantic-ast/src/Main.hs index 47cf89af2..a5b140e87 100644 --- a/semantic-ast/src/Main.hs +++ b/semantic-ast/src/Main.hs @@ -39,14 +39,12 @@ main = generateAST =<< execParser opts generateAST :: SemanticAST -> IO () generateAST (SemanticAST _ source) = do - case source of + bytestring <- case source of Left filePath -> do - bytestring <- Data.ByteString.readFile filePath - printByteString bytestring + Data.ByteString.readFile filePath Right source -> do - let bytestring = Data.ByteString.Char8.pack source - printByteString bytestring - where printByteString bytestring = print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring + pure $ Data.ByteString.Char8.pack source + print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring opts :: ParserInfo SemanticAST opts = info (parseAST <**> helper)