mgrabmueller / AlgorithmW

Example implementation of Algorithm W for Hindley-Milner type inference
BSD 3-Clause "New" or "Revised" License
77 stars 11 forks source link

Changed the generation of type variable names #8

Closed rcythr closed 4 years ago

rcythr commented 4 years ago

Great resource, thanks for putting it out on the web for everyone to learn from.

I thought the type and output of newTyVar was a little ugly, so I wrote up a little patch to change it:

  1. It no longer requires an argument, which is quite satisfying looking in the Monad.
  2. It produces more friendly TyVar values.

This is mostly an aesthetic thing as I much prefer type variables (a, b, c, d, ..., aa, ab, ...) to (a0, a1, a2, a3, a4, ...). If you don't agree then feel free to reject this PR.

mgrabmueller commented 4 years ago

Thanks for the contribution, I like the change.