Get the latest tech news

Having your compile-time cake and eating it too


Mixing Hindley-Milner with compile-time programming

They track the types of values in our programs before we run them, which not only saves us from runtime crashes but enforces guidelines for writing good code. The most popular one is called Hindley-Milner(HM), and it's used by many big languages, including Swift, Rust, Scala, Haskell, OCaml, and more. I think a good way to end this post is by putting it all together to make a trait called Stringable where the default implementation of to_string is automatically generated for structs.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of time cake

time cake