Re: avoiding repeated use of show

1998-07-28 Thread Olivier Danvy
> Simon L Peyton Jones wrote: > > [...] Let me advertise Olivier Danvy's very cunning idea to implement > > printf in Haskell/ML. > > > > http://www.brics.dk/RS/98/5/index.html > A revised version is available in http://www.brics.dk/RS/98/12/index.html It is the extended version of

Re: avoiding repeated use of show

1998-07-27 Thread Zhe Yang
Sven Panne wrote: > Simon L Peyton Jones wrote: > > [...] Let me advertise Olivier Danvy's very cunning idea to implement > > printf in Haskell/ML. > > > > http://www.brics.dk/RS/98/5/index.html > > Very cunning, indeed. But it has as small efficiency problem because > of the use of (++).

Re: avoiding repeated use of show

1998-07-23 Thread Fergus Henderson
On 22-Jul-1998, S. Alexander Jacobson <[EMAIL PROTECTED]> wrote: | On Wed, 22 Jul 1998, Simon L Peyton Jones wrote: | | > Let me advertise Olivier Danvy's very cunning idea to implement | > printf in Haskell/ML. | > | > http://www.brics.dk/RS/98/5/index.html | | Printf isn't really what I w

Re: avoiding repeated use of show

1998-07-22 Thread Ralf Hinze
| I would be more inclined to use <<. The reason is typing efficiency. | '&' is awkward to be typing frequently immediately after '"'. I do not type that fast ;-). | You are acutally using (.) below. Is there a way to do that (via | Fran like lifting?)? I'm afraid no. | > > instance Stringab

Re: avoiding repeated use of show

1998-07-22 Thread Sven Panne
Simon L Peyton Jones wrote: > [...] Let me advertise Olivier Danvy's very cunning idea to implement > printf in Haskell/ML. > > http://www.brics.dk/RS/98/5/index.html Very cunning, indeed. But it has as small efficiency problem because of the use of (++). This can be easily cured by usin

Re: avoiding repeated use of show

1998-07-22 Thread Patrik Jansson
This might be a reasonable solution for the the "concatenation" operator you want: [This does not solve the numeric ambiguity - I think that is impossible.] infixl 1 << class Stringable a where (<<) :: String -> a -> String instance Stringable a => Stringable [a] where s << [] = s s << (x

Re: avoiding repeated use of show

1998-07-22 Thread S. Alexander Jacobson
On Wed, 22 Jul 1998, Ralf Hinze wrote: > What about `&' for catenation? I would be more inclined to use <<. The reason is typing efficiency. '&' is awkward to be typing frequently immediately after '"'. You are acutally using (.) below. Is there a way to do that (via Fran like lifting?)? > >

Re: avoiding repeated use of show

1998-07-22 Thread Ralf Hinze
> I would like to avoid using show all the time for printing strings e.g. > > > val = "the sum of 2 and 2 is "++(show $ 2 + 2)++" whenever." > > I would prefer to type something like: > > > val = "the sum of 2 and 2 is "./(2+2)./" whenever." > > -- i can' find a better haskell compatible opera

Re: avoiding repeated use of show

1998-07-22 Thread S. Alexander Jacobson
On Wed, 22 Jul 1998, Simon L Peyton Jones wrote: > Let me advertise Olivier Danvy's very cunning idea to implement > printf in Haskell/ML. > > http://www.brics.dk/RS/98/5/index.html Printf isn't really what I want, but I am happy to take a look. I am really looking for a my scripting like

Re: avoiding repeated use of show

1998-07-22 Thread Simon L Peyton Jones
> I would like to avoid using show all the time for printing strings e.g. > > > val = "the sum of 2 and 2 is "++(show $ 2 + 2)++" whenever." > > I would prefer to type something like: > > > val = "the sum of 2 and 2 is "./(2+2)./" whenever." > > -- i can' find a better haskell compatible opera

Re: avoiding repeated use of show

1998-07-21 Thread Alex Ferguson
Alex Jacobson: > > > > (./) :: (Stringable a,Stringable b)=> a->b->String > > > > x./y = (toString x)++(toString y) > > Wouldn't it be a great deal less tortuous to define: > > > > > x .++ y = show x ++ y > > > > > x ++. y = x ++ show y > > > > and then to use (++), (.++), or (++.), as approp

Re: avoiding repeated use of show

1998-07-21 Thread Alex Ferguson
S. Alexander Jacobson writes: > So I tried creating my own Stringable class: > > class Stringable a where > > toString::a -> String > > (./) :: (Stringable a,Stringable b)=> a->b->String > > x./y = (toString x)++(toString y) Wouldn't it be a great deal less tortuous to define: > x .++ y = sho

Re: avoiding repeated use of show

1998-07-21 Thread S. Alexander Jacobson
On Tue, 21 Jul 1998, Alex Ferguson wrote: > > So I tried creating my own Stringable class: > > > class Stringable a where > > > toString::a -> String > > > > (./) :: (Stringable a,Stringable b)=> a->b->String > > > x./y = (toString x)++(toString y) > > Wouldn't it be a great deal less tortuous

avoiding repeated use of show

1998-07-21 Thread S. Alexander Jacobson
I would like to avoid using show all the time for printing strings e.g. > val = "the sum of 2 and 2 is "++(show $ 2 + 2)++" whenever." I would prefer to type something like: > val = "the sum of 2 and 2 is "./(2+2)./" whenever." > -- i can' find a better haskell compatible operator I can't sim