printf

Lennart Augustsson lennart at augustsson.net
Thu Nov 25 03:05:20 EST 2004


My printf was a sprintf too.  I.e., the return value could be
eoither `IO a' or String.  Easy to implement, but probably
confusing. :)

	-- Lennart

John Goerzen wrote:
> On 2004-11-24, Simon Marlow <simonmar at microsoft.com> wrote:
> 
>>On 23 November 2004 20:34, Lennart Augustsson wrote:
>>I'd like to pull this in, or something like it.  IMHO, the lack of
>>static type safety is outweighed by the shear convenience, and it's too
>>small to provide as a separate library.
>>
>>It'd be nice to have 
>>
>>  hPrintf :: (PrintfType a) -> Handle -> String -> a
> 
> 
> Don't forget sprintf, though I haven't yet studied this code enough to
> figure out how to do it with this model.
> 
> sprintf could and should be a pure function that can be executed outside
> the IO monad.  Quite useful for, say, internals of a string generation
> routine.
> 
> -- John
> 
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
> 



More information about the Libraries mailing list