Proposal: Replace Text.Printf with extensible, complete version

Joachim Breitner mail at joachim-breitner.de
Tue Sep 17 09:30:48 CEST 2013


Hi Bart,

Am Montag, den 16.09.2013, 18:28 -0700 schrieb Bart Massey:
> Greetings. This proposal is an extension of previous discussion on the
> libraries list about replacing Text.Printf with my updated version
> that provides extensibility of printf to user datatypes and implements
> much more of the C printf spec, while maintaining
> backward-compatibility with existing users of printf.

thanks for bringing this officially to the committee’s attention.

Given the backwards-compatible form of the patch, and the broad support,
I believe we can go on and include this in base now. Unless someone
complains today, I’ll look into pushing this tomorrow.

> There is a separable proposal to move Text.Printf from base into its
> own package. I support that proposal, but believe that we can take
> them in either order, and this is the part I know how to do :-).

I don’t think we should remove it from base for this release. Hopefully
we’ll tackle the larger base-splitting-and-shimming for the next
release, and it would be nicer to our users to have only one round of
“if you use feature x, which was removed from base, use package y”.

Too bad that we don’t have module re-exports on the package level,
otherwise I had suggested that you
 * create a package printf that re-exports Text.Printf and
 * base:Text.Printf gives a deprecation warning, telling people to use 
   Text.Printf (note the same name) from the printf package.

But that is a side-note and not related to the proposal at hand.

> Attached please find a patch that implements the proposal. Note that
> it also makes slight, backward-compatible modification to Numeric and
> GHC.Float to avoid a whole bunch of pointless code duplication. The
> printf patch is kind of ugly because so much of Text/Printf.hs has
> been replaced. Let me know if it would be better to just provide the
> whole source. The patch applies and builds against my current
> top-of-tree GHC.

I find links to github branches (e.g. something like
<https://github.com/BartMassey/packages-base/compare/new-printf>) nice,
but of course the patch is fine.

In your original mail you said that you created a testsuite. Is there a
way to include them in base’s testsuite? Note that there are already
Text.Printf-tests in there.
But be careful about the copyright of the files you copy there; if
required add their status to LICENSE.
OTOH, if we expect to to separate the code again in the next release and
you don’t find base’s testrunner pleasant to work with, you can skip
this.

Would you mind writing a sentence or short paragraph for the release
notes, describing your changes?

> While I would welcome shortening the discussion given how much has
> already been discussed, Monday 30 September is two weeks from today,
> so I will treat that as the discussion deadline unless I hear
> otherwise.

As I said, I don’t think we need the full discussion time frame, and
rather try to squeeze this into base for 7.8. (My opinion, if someone
disagrees please shout.)

Greetings,
Joachim
-- 
Joachim Breitner
  e-Mail: mail at joachim-breitner.de
  Homepage: http://www.joachim-breitner.de
  ICQ#: 74513189
  Jabber-ID: nomeata at joachim-breitner.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130917/434478f5/attachment.pgp>


More information about the Libraries mailing list