Get the latest tech news
The Type of Sprintf
Most static type systems wouldn't let you make something like sprintf, whose type is determined by a format string. Dependent types can save the day!
Obviously this code doesn't meet a full specification of sprintf, and is implemented in a pretty unoptimized way (something like \(O(N)\) time complexity in the size of the format string). I hope, however, that you can start to see that dependent types can be extremely powerful and expressive while staying completely at compile-time. Personally, I find large eliminations very useful for writing proofs, such as when I want to prove that certain ADT constructors are impossible at a certain point.
Or read this on Hacker News