[ghc-steering-committee] A few more pleas

Richard Eisenberg rae at richarde.dev
Tue Dec 8 03:47:37 UTC 2020


A plea for DerivingStrategies: GHC currently chooses which strategy to use rather arbitrarily. (For example, did you know that Eq and Ord are derived by GeneralizedNewtypeDeriving whenever possible, even when that extension isn't enabled?) And Show is always derived by the `stock` strategy, even when GND is enabled (and otherwise possible). Instead, DerivingStrategies allows users to be explicit, and (in my opinion) should be a matter of good style, just like top-level type signatures. Having to enable the extension to use good style is an annoying hurdle. While the set of strategies may evolve, the idea of writing out strategies (and their syntax) feels stable to me.

A plea for NamedWildCards: This feature allows type variables beginning with an underscore to be treated as a component in a partial type signature. Critically (for this plea), a type signature with a named wild card will not be accepted without -XPartialTypeSignatures. I do *not* advocate for -XPartialTypeSignatures! So, having -XNamedWildCards on simply means that we get an informative error message when the user writes a type variable beginning with an underscore. The only downside is that programs such as id :: _a -> _a are no longer accepted. But does anyone write type variables with leading underscores? If we think this is at all common, then I would change my mind here. Why have it on by default? Because it's not easily discoverable, and the error messages really are quite nice.

A plea against MonoLocalBinds (and, hence, TypeFamilies): MonoLocalBinds is fork-like: it will mean that some Haskell98 programs will not be accepted. And to get those programs accepted, a user might need ScopedTypeVariables -- in specific, the aspect of ScopedTypeVariables that seems likeliest to change in the future. So I don't think we should have MonoLocalBinds on by default.

Thanks for reading!
Richard


More information about the ghc-steering-committee mailing list