[GSoC 2023] Call for Ideas

Here’s a sketch of an idea that could be interesting for a GSoC project for which I’d like community input.

A migration tool to help code bases move across ghc versions.

It seems to me that not all breaking changes and deprecation warnings can be addressed the same way. However, some breaking changes could potentially be fixed automatically be a Haskell specific tool.

Consider the deprecation of * for Type in the kind signatures. A simple regex would not be able to address this easily, * might show up in many different places.

A Haskell specific tool could address this by doing a static analysis of the source and identifying * in kinds standing for Type by use of the ghc api (or ghc-wrappers) (because * in the kinds might also mean Nat multiplication).

Granted, the “rule” to migrate * to Type might not be trivial, but hopefully would only need to be done once.

So, I think it would be interesting to do something along the lines of:

  • Investigate the breakage issues on existing code bases stuck on 8.10 trying to migrate to 9.0, and from those identify the ones that could be automated through static program analysis

  • Develop an embedded language in Haskell that would work a bit like regex (you would write an expression that is expected to match against programs), but much more sofisticated using operators to e.g. match against a GHC HsType constructor.

    • In pseudo-code, the * to Type rule could be like replace (/HsStarTy/g) (type @Type)
  • Develop the tool that executes the rules possibly interactively with user controls

  • Write rules for 8.10 → 9.0 transition

Again, this is just an over simplified sketch, but I’d like to hear your opinions

1 Like