I know of a few ghc plugins:
norecursion: Allows for making recursion useful, avoiding recursion bugs.
ghc-typelits-normalize Allows for making Type level
typelet: Allows type level let
monadic-bang: Allows for idris ! syntax.
There is also the polysemy and or-constraint ones.
I just saw monadic-bang and it seemed cool, and I began to wonder what other cool plugins there are that could make the haskell experience better?
opentelemetry-plugin to hook up OpenTelemetry to GHC and measure various thing about building Haskell programs.
I’ve never used it though!
I use monadic-bang all the time and it’s great. I still think it should be a native extension, because there are a few issues with plugins that add syntax.
- When there’s a syntax error anywhere in the file, there will be a syntax error for each
!expressionas well - There’s no way to integrate with code formatters — Ormolu has no idea what’s going on and fails at the first
!expression - It would be nice to allow a low-precedence form
<- expressioninstead of (or in addition to) the high-precedence!expression, because in practice, having!be high-precedence doesn’t allow me to drop parentheses very often, and I’d rather writeif <- f x then …instead ofif !(f x) then …, andf (<- g x) <- h yinstead off !(g x) !(h y)
Not exactly useful at the moment, but I always wanted to continue my assert-explainer plugin: GitHub - ocharles/assert-explainer: Py.test style assertions in Haskell
The final work i did for the GSoC that just ended was a GHC plugin that serializes and deserializes cmm . Cmm being the GHC code generation IR. It gets translated from a higher level IR and then translated directly to machine code, to llvm or to wasm
One of my goals in Skeletest is to provide helpful error messages. If you like pytest, you might also like the Fixtures mechanism.
On a similar topic, I have a simple TH function that lets you match on data structures without having to state all sub-parts of the structure. In the example below I’ve omitted various fields (like source location information which is verbose), and used _ where ArrayExpression was important, but its content wasn’t. It’s like writing a case but without having to write the RHS or wildcard case. My hope for a follow up would be having it report the diff rather than a simple boolean. I think if you have an instance of Lift, you could diff on the AST.
Your example could be e.g. shouldBeLift xs [| [_,_,_] |] which is occasionally nicer, depending on the task. But it’s only a subset of the things your plugin can help with, which is much broader.