RedPRL / asai

🩺 A library for compiler diagnostics
https://ocaml.org/p/asai
Apache License 2.0
35 stars 2 forks source link

🔣 A domain-specific language with handler combinators #186

Open favonia opened 3 weeks ago

favonia commented 3 weeks ago
  1. Dispatching diagnostics to different handlers
  2. Duplicating diagnostics to multiple handlers
  3. Filtering diagnostics
kentookura commented 3 weeks ago

I was going to write a response here that something like a handler combinator thingy is the more natural way to proceed, but you beat me to it :)

favonia commented 3 weeks ago

@kentookura Are you claiming that with these three combinators you can already implement the features you wanted trivially?

kentookura commented 3 weeks ago

Yes, I think so

kentookura commented 2 weeks ago

One thing that I want to point out is that when implementing a language server, it is important that an empty list of diagnostics gets pushed when a computation that previously failed now succeeded. Right now I am checking this manually, but maybe this is an interesting factor when designing this.

Another thing is that diagnostics need a URI to be published to, and a computation might raise diagnostics for many files. I am handling this by

This is not enough, though: Say that evaluating file A previously failed and had a diagnostic pushed to it. Running the evaluator again now succeeds, but now I need to know that A failed the last time in order to push an empty list to clear the diagnostics, so I need to track some state.