Ticket #3058: Add 'hex' to the pretty package (and other thoughts)

Isaac Dupree ml at isaac.cedarswampstudios.org
Sat Mar 14 19:58:23 EDT 2009


Thomas DuBuisson wrote:
> In a couple days it will be the two week mark and I'll be posting a
> summary of this conversation on the ticket.  At this point I don't see
> any disagreement, just questions regarding the completeness of the
> patch (so I included many more functions from Numeric).  The final
> type signatures are:
>
> efloat :: (RealFloat a) => Maybe Int -> a -> Doc
> ffloat :: (RealFloat a) => Maybe Int -> a -> Doc
> gfloat :: (RealFloat a) => Maybe Int -> a -> Doc
> hex :: (Integral a) => a -> Doc
> hexPad :: (Integral a) => a -> Int -> Doc
> intAtBase :: (Integral a) => a -> (Int -> Char) -> a -> Doc
> intAtBasePad :: (Integral a) => a -> (Int -> Char) -> a -> Int -> Doc
> oct :: (Integral a) => a -> Doc
> octPad :: (Integral a) => Maybe Int -> a -> Int -> Doc
>
> Which follows the Numeric module pretty close (except the *Pad
> functions, which are obvious devivations).

are the "Pad" functions ones that (as mentioned above) are willing not just to 
add padding but to chop off higher-order digits?  I find the name misleading.

Also hexPad and intAtBasePad each add (compared to the non-Pad versions) an 
Int argument, but octPad adds an Int and a Maybe Int argument?  why is this?

-Isaac



More information about the Libraries mailing list