hawk icon indicating copy to clipboard operation
hawk copied to clipboard

auto-printf

Open gelisam opened this issue 11 years ago • 0 comments

Haskell supports printf, but the format string isn't used by type inference, so a command such as

> echo "1\t2" | hsl '(x,y) -> printf "%d-%d" x y'`

Would fail because the types of x and y are ambiguous. Worse: our default behaviour for ambiguous types is to assume ByteString, but that will fail at runtime since the printf formatter explicitly requests integers.

I would like to detect calls to printf, parse its format string, and add the appropriate type annotation. But that's not going to happen soon; string processing is not Python's strength.

Hey, I know, I should rewrite the Python part in Haskell!

gelisam avatar Aug 05 '13 12:08 gelisam