xformat feedback
Simon Michael
simon at joyful.com
Fri Aug 20 09:31:02 EDT 2010
Sean - thanks very much! That helps a lot.
haskell-libs was a misspelling of the libraries at haskell.org list,
which I've taken the liberty of cc'ing once again. It's on gmane.org
too.
Best,
-Simon
On Aug 20, 2010, at 3:36 AM, Sean Leather wrote:
> Ha! :) Yes, I was "asking for it," wasn't I? And you're absolutely
> right. I gave examples in the announcement email when I asked for
> feedback, but I didn't include any in the documentation. I will fix
> that.
>
> I found out more at http://github.com/spl/xformat/tree/master/
> tests/ . What I was hoping for was a way to do printf, without the
> variable arguments which make reuse troublesome, but still using
> standard printf format strings. Does this lib do that ?
>
> Hmm. Let me see if I can try to answer that question.
>
> Here's a basic example:
>
> *Text.XFormat.Show> showf ("Hello " % String % " #" % Num % "!")
> "World" 1
> "Hello World #1!"
>
> As you can see, this does not use the "standard printf format
> string." Instead, it uses a type-indexed function 'showf' to produce
> a new function 'showf ("Hello " % String % " #" % Num % "!")' that
> allows only certain types for arguments. To help see this, here is
> that type:
>
> *Text.XFormat.Show> :t showf ("Hello " % String % " #" % Num % "!")
> showf ("Hello " % String % " #" % Num % "!") :: (Num a) => String ->
> a -> String
>
> Thus, we have a type-safe printf.
>
> One option that I have considered is writing a quasiquoter to allow
> you to do standard printf format strings, but I haven't found a
> round tuit for that, yet.
>
> Hope this answers your question. Thanks for bringing this up.
> xformat needs some TLC after a long time. I just didn't know how it
> would be used and what direction to take it in.
>
> BTW, what is haskell-libs at haskell.org ? I've never seen that before.
>
> Regards,
> Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/libraries/attachments/20100820/37422057/attachment.html
More information about the Libraries
mailing list