open
open copied to clipboard
Source mapping for Inliterate
I was thinking that maybe it would be useful to have source maps generated by inliterate
so in case of error, one could parse it, look into the source map file and replace it so the user could see where the real errors are instead of random numbering 😃 .
Does this make sense for you? I'm thinking about implementing error highlighting in Haskell.do, but without this it would be very difficult.
I would be willing to help with this 😁
Is this possible? Can you link to GHC doc page if so?
I'm not really sure if this is possible, it was just an idea that maybe could make sense, I was thinking about hand parsing both files, the source and the generated, and try to find the line with an error from the generated one in the source. Might not cover all the use cases, but I think it could be a start
This should be possible using GHC's LINE
and COLUMN
pragmas: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#line-pragma
@vasiliyl :arrow_up: this looks quite promising. @glutamate would you like to have me submit a pull request for this? If so, could you please point me where the code generation is made so I can add these pragmas?
@vasiliyl @NickSeagull i agree this is the way to go. Right now everything is parsed by cheapskate with its markdown
and i dont think its Doc
type preserves the source line location? but cheapskate could be replaced, there are many haskell markdown parsers. I would be reluctant to change to a GPL licensed parser though.
@glutamate agree 100% with the GPL decision