New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demo #690
Conversation
| parseFile :: (Has (Throw String) sig m, MonadIO m) => FilePath -> m (Source.Source, File Term) | ||
| parseFile path = do | ||
| contents <- liftIO (B.readFile path) | ||
| let sourcePath = replaceExtensions path "py" | ||
| -- FIXME: this is comprised of several terrible assumptions. | ||
| sourceContents <- Source.fromUTF8 . B.toStrict <$> liftIO (B.readFile sourcePath) | ||
| parseFile :: (Has (Throw String) sig m, MonadIO m) => FilePath -> FilePath -> m (Source.Source, File Term) | ||
| parseFile srcPath jsonPath = do | ||
| contents <- liftIO (B.readFile jsonPath) | ||
| -- FIXME: get this from the JSON itself (cf https://github.com/tree-sitter/tree-sitter-graph/issues/69) | ||
| let sourcePath = replaceExtensions jsonPath "py" | ||
| sourceContents <- Source.fromUTF8 . B.toStrict <$> liftIO (B.readFile srcPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very slightly less gross than it had been, but still pretty gross. Basically what it amounts to is a way to allow the JSON path and the loaded source file to vary: in the demo's case, I wanted both b.py and b2.py to load their respective sources correctly while still obtaining the module name b.
As of this PR, we're making one fewer assumption than we had been, so I'm content with it for the moment, but a real solution will be needed at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.


Some last tweaks to polish off the exception tracing demo.