Skip to content

Clean up HsOverLit's ol_witness field

Currently, HsOverLit has an ol_witness field that is used very inconsistently:

  • Before renaming, it's vestigial
  • After renaming, but before typechecking, it contains the coercion operator's name, e.g. fromIntegral
  • After typechecking, it contains the value witness, e.g. fromIntegral 42

This is very confusing and also it suggests a bogus degree of freedom: that we can sidestep the rebindable syntax resolution by providing our own ol_witnesses on the input to renaming.

"Trees that grow" of course gives us a way out: move ol_witness from HsOverLit to OverLitTc, add OverLitRn with a new ol_from_fun field (which is the name of the coercion operator, not a full-blown expression), and adapt all existing code.

Edited by Gergő Érdi
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information