haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.72k stars 368 forks source link

Simplify `handleMaybeM` in `hls-plugin-api` #3563

Open July541 opened 1 year ago

July541 commented 1 year ago

Currently, we have many use cases for handleMaybeM like the following, and it gradually being our regular mode of running action. I propose that can simplify it and just pass the action type itself. Like handleMaybeM' TypeCheck nfp to get the same effect as handleMaybeM.

image
michaelpj commented 1 year ago

I agree, it would be nice to refactor this stuff, it's very verbose and everywhere. I wonder if we should actually give plugins a proper monad to run in rather than Either String _ or whatever they currently have :thinking:

July541 commented 1 year ago

Either String _ is acceptable, but a new design monad may be more suitable for our application.