Top 19 Compiler Plugin Open-Source Projects
Flexible Scala code linting toolProject mention: Newspeak and Domain Modeling | news.ycombinator.com | 2021-06-29
or `NonUnitStatements` without explicit annotation.
This effectively locks you into writing pure code (you can extend the linter to cover other things like not using `Future` or not using Java libs outside of `MonadError` from cats). The linters operate on typed ASTs at compile time, and have plugins for the most popular scala build tools. Coupled with `-XFatalWarnings', you can guarantee that nothing unexpected happens unless you explicitly pop the escape hatch, for the most part.
You can still bring in external libraries that haven't been compiled with these safties in place, so you aren't completely safe, but if you use ZIO/Typelevel libraries you can be reasonably assured of referentially transparent code in practice.
There are three schools of thought, roughly, in the scala community towards the depth of using the type system and linters to provide guarantees and capabilities, currently:
1) Don't attempt to do this, it makes the barrier to entry to high for Scala juniors. I don't understand this argument - you want to allow runtime footguns you could easily prevent at compile time because the verifiable techniques take time to learn? Why did you even choose to use a typesafe language and pay the compilation time penalty that comes with it?
2) Abstract everything to the smallest possible dependency interface, including effects (code to an effect runtime, F[_] that implements the methods your code needs to run - if you handle errors, F implements MonadError, if you output do concurrent things, F implements Concurrent, etc.) and you extend the effect with your own services using tagless final or free.
3) You still use effect wrappers, but you bind the whole project always to use a concrete effect type, avoiding event abstraction, thus making it easier to code, and limiting footguns to a very particular subset (mainly threadpool providers and unsafeRun or equivalent being called eagerly in the internals of applications).
My opinion is that smallest interface with effect guarantees (#2) is best for very large, long maintenance window apps where thechoice of effect runtime might change(app), or is out of the devs' control (lib); and #3 is best for small apps.
TL/DR; You can go a really, really long way to guaranteeing effects don't run in user code in scala. Not all the way like Haskell, but far enough that it's painful to code without conforming to referential transparency.
Desugaring scala `for` without implicit `withFilter`s
Scout APM: A developer's best friend. Try free for 14-days. Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues and can get back to building a great product faster.
better implicit errors for scalaProject mention: Getting Comfortable with Implicits | reddit.com/r/scala | 2021-08-24
In Scala 2.13 and above, there is a compiler switch that will print out the exact implicit you are missing at compile time and why (https://docs.scala-lang.org/overviews/compiler-options/errors.html). Prior to that in scala 2, you need the tek/splain compiler plugin (https://github.com/tek/splain).
Functional companion to Kotlin's CompilerProject mention: If I wanted to modify the Kotlin grammar, how would I go about doing that? | reddit.com/r/Kotlin | 2021-05-01
As of right now, Arrow Meta is the only library I am aware of with which you can productively write compiler plugins.
Static Analysis Compiler Plugin for Scala (by HairyFotr)
:wrench: Kotlin Native/JS/JVM Annotation Processor library for Kotlin compiler pluginsProject mention: Examples of third party compiler plugins | reddit.com/r/Kotlin | 2021-01-11
KVision uses compiler plugin: https://github.com/rjaros/kvision/tree/master/kvision-tools based on https://github.com/Foso/MpApt library.
A framework to create embedded Domain-Specific Languages in Scala
Run Linux Software Faster and Safer than Linux with Unikernels.
Inspection Testing for HaskellProject mention: [ANN] core-warn: A package for detecting unexpected Core output! | reddit.com/r/haskell | 2021-10-23
Haven't tried it but afaik related: inspection-testing should allow you to assert various properties about the generated core.
Let GHC prove program equations for you
A Kotlin compiler plugin that removes the `copy` method of data classes.Project mention: Assuming the data class's generated copy() is unacceptable, what's the best way to implement a value type? | reddit.com/r/Kotlin | 2021-09-03
Using this compiler plugin library: https://github.com/AhmedMourad0/no-copy
Next gen DI framework powered by a Kotlin compiler plugin [WIP] (by IVIanuu)Project mention: Here is an article about my DI library for Kotlin Mutliplatform | reddit.com/r/androiddev | 2021-11-19
Similar effort that's a bit more fleshed out: https://github.com/IVIanuu/injekt
A compiler plug-in to control object lifetimes in Scala (by TiarkRompf)
A helpful companion to GHC. Overrides GHC messages, to the user's liking.
Minimise haskell imports, make exports explicit
GHC plugin for constant math elimination
Presburger arithmetic solver for built-in type-level naturals
BinderAnn: Automated Reification of Source Annotations for Monadic EDSLs
Type checker plugins without the type checking. (by BlockScope)
Compiler Plugin related posts
[ANN] core-warn: A package for detecting unexpected Core output!
2 projects | reddit.com/r/haskell | 23 Oct 2021
[Kind-Lang] Getters and Setters done right in a pure functional language
3 projects | reddit.com/r/programming | 17 Oct 2021
Assuming the data class's generated copy() is unacceptable, what's the best way to implement a value type?
1 project | reddit.com/r/Kotlin | 3 Sep 2021
Getting Comfortable with Implicits
1 project | reddit.com/r/scala | 24 Aug 2021
What don't you like about kotlin?
1 project | reddit.com/r/Kotlin | 1 Apr 2021
Modelling value types in kotlin
1 project | dev.to | 3 Nov 2020
What are some of the best open-source Compiler Plugin projects? This list will help you:
|10||NoCopy Compiler Plugin||113|
Are you hiring? Post a new remote job listing for free.