[Haskell-cafe] Very crazy

Andrew Coppin andrewcoppin at btinternet.com
Tue Sep 25 06:09:52 EDT 2007


Brandon S. Allbery KF8NH wrote:
>
> On Sep 25, 2007, at 5:56 , Andrew Coppin wrote:
>
>> More seriously, I have no idea how you'd implement this in Haskell. 
>> Presumably the standard show instance for Int, Double, etc. is in 
>> native C? You could probably reimplement it in Haskell for the 
>> integer case, but not for floating-point...
>
> Actually, Text.Printf is pure Haskell.  (Very *scary* Haskell:  deep 
> type hackery is needed to make it work.  Don't try to understand 
> PrintfType.  :)
>
Forget PrintfType - I can't even understand the haddoc page yet!

(printf performs I/O, yet it is outside the I/O monad. It seems to 
accept an arbitrary number of arguments, which is obviously impossible. 
It's *almost* as scary as the original. Although the original will crash 
your program is you use it wr... oh, so does this one. Cool.)



More information about the Haskell-Cafe mailing list