Get the latest tech news
A Tour of Hell – Shell scripting Haskell dialect
Feb 9th 2024 This set of slides sketches out the implementation of Hell, in technical detail. I do tend to switch between the slides, old code, and the present code, so bear with me.
I encountered another approach while perusing Oleg Kiselyov's Typed Tagless Final Interpreters paper and he dropped in this example like it was the most normal thing in the world. The cmpTy function starts with an a and b and by pattern-matching and aided by a handy GADT called Equal which essentially makes first class the ability to get both a value-level and type-level proof that a ~ b. The trick here is simply to dispatch on the well-typed type-indexed GADT of Type and in that case one can "capture" the type-class instance dictionary and then the T_Add constructor is able to use that for its class constraint!
Or read this on Hacker News