I want to extract the position information on lexing errors so I can send them to an LSP client, but the error type for the wrappers is hard coded to be string, so it is difficult to send along that extra information.
As far as I can tell, the change would mostly consist of replacing Either String a with Either err a, adding a corresponding type parameter to Alex a and adjusting the line
AlexError ((AlexPn _ line column),_,_,_) -> alexError $ "lexical error at line " ++ (show line) ++ ", column " ++ (show column)
- Is there an easier way to do this?
- Am I missing some problems with this approach?
I want to extract the position information on lexing errors so I can send them to an LSP client, but the error type for the wrappers is hard coded to be string, so it is difficult to send along that extra information.
As far as I can tell, the change would mostly consist of replacing
Either String awithEither err a, adding a corresponding type parameter toAlex aand adjusting the line