I spent a few hours doing some very GADT-y things in Scala 2 and being very impressed with how well the compiler behaved.
Things like the attached screenshot, which honestly, the way I can use t
in the pattern match and have the compiler work out that expr
must be of type Expr[X]
is really cool.
Went a little overboard with the whole thing, and then realised I'd messed up my command line arguments and was working in Scala 3... Reverting to Scala 2 was quite painful.
=> More informations about this toot | More toots from NicolasRinaudo@functional.cafe
It also took me a shamefully long time to realise you could use non-parametric sum types with a single, parametric variant to have convenient type equalities in pattern matches
=> More informations about this toot | More toots from NicolasRinaudo@functional.cafe
text/gemini
This content has been proxied by September (3851b).