Last active
August 29, 2015 14:09
-
-
Save jszmajda/90be5ebf1aa7304b53b4 to your computer and use it in GitHub Desktop.
Text.Printf return type polymorphism example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prelude> import Text.Printf | |
Prelude Text.Printf> printf "%0.2f\n" 3.14159 -- will write the line to STDOUT | |
3.14 | |
Prelude Text.Printf> printf "%0.2f\n" 3.14159 :: String | |
"3.14\n" | |
Prelude Text.Printf> :t printf "%0.2f\n" 3.14159 :: IO () | |
printf "%0.2f\n" 3.14159 :: IO () :: IO () | |
Prelude Text.Printf> :t printf "%0.2f\n" 3.14159 :: String | |
printf "%0.2f\n" 3.14159 :: String :: String |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment