
Chaddaï Fouché wrote:
2007/9/25, Andrew Coppin
: printf don't always perform IO : if you ask it for a String it will happily turn into sprintf for you, if you use it in the IO Monad, it will indeed perform IO, but there's nothing fundamentally IO bound in printf logic.
That's even *more* impossible... o_O
Why ?
How can one function have more than one type signature?

On Sep 25, 2007, at 7:25 , Andrew Coppin wrote:
Chaddaï Fouché wrote:
2007/9/25, Andrew Coppin
: printf don't always perform IO : if you ask it for a String it will happily turn into sprintf for you, if you use it in the IO Monad, it will indeed perform IO, but there's nothing fundamentally IO bound in printf logic.
That's even *more* impossible... o_O
Why ?
How can one function have more than one type signature?
Polymorphism via typeclasses. PrintfType is rather hairy, as I said, but it can do the job by having instances for IsString (itself a hack of sorts) and IO. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

Text.printf only has one type. But it is a bit involved. Just use it
without worrying exactly how it works. :)
Like 's ++ printtf "%g*x%d" x i'
On 9/25/07, Andrew Coppin
Chaddaï Fouché wrote:
2007/9/25, Andrew Coppin
: printf don't always perform IO : if you ask it for a String it will happily turn into sprintf for you, if you use it in the IO Monad, it will indeed perform IO, but there's nothing fundamentally IO bound in printf logic.
That's even *more* impossible... o_O
Why ?
How can one function have more than one type signature?
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (3)
-
Andrew Coppin
-
Brandon S. Allbery KF8NH
-
Lennart Augustsson