(Sorry for the crosspost; I'm not sure which list this should go to.)
I've just completed a pure-Haskell printf. Docs at [1], download at
[2].
Here are some examples:
vsprintf "Hello"
> "Hello"
vsprintf "Hello, %s\n" "John"
> "Hello, John\n"
vsprintf "%s, your age is %d\n" "John" (10::Integer)
> "John, your age is 10\n"
sprintfAL "%(name)s, your age is %(age)d\n"
[("name", v "John"),
("age", v (10::Integer))]
> "John, your age is 10\n"
I have more examples available at the doc page[1].
I used Ian Lynagh's Printf.Printer module to do the actual formatting (I
converted it away from TH first). I got the idea for simulating
handling variable numbers of function arguments from the haskell-xml-rpc
code.
I would appreciate comments/critiques.
-- John
[1] http://gopher.quux.org:70/devel/missingh/html/MissingH.Printf.html
[2] http://gopher.quux.org:70/devel/missingh
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe