How does Haskell printf work?
The trick is to use type classes. In the case of printf, the key is the PrintfType type class. It does not expose any methods, but the important part is in the types anyway. class PrintfType r printf :: PrintfType r => String -> r So printf has an overloaded return type. In the trivial … Read more