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?)?
 
> > instance Stringable ShowS where
> >     toStrings                       =  id
> 
> This instance declaration is necessary to make `&' useable. Note that
> this is not (Standard) Haskell but works only with Hugs 1.3c (and
> probably with GHC's next release).

Why does this instance declaration require 1.3c?  Also, are there
substantive differences between Hugs 1.3c and GHC 3.3?  Are people
prototyping w/ 1.3c and then planning to build with the next GHC?

> > (&)                         :: (Stringable a, Stringable b) => a -> b -> ShowS
> > a & b                               =  toStrings a . toStrings b
> 
> Note that `&' yields `ShowS' and not `String'.
> 
> > val = "the sum of 2 and 2 is " & (2 + 2 :: Int) & " whenever."

> Furthermore note that `val' has type `ShowS'. If quadratic time
> behaviour is not a problem (does not occur?) you can safely omit the
> `Stringable ShowS' instance and change `&' to `toString a ++ toString b'.

I am not understanding this last bit.  Can you explain further?
 
> `render' is quite flexible:
> 
> ? render val
> the sum of 2 and 2 is 4 whenever.
> ? render (toString "aaa")
> aaa
> ? render "aaa"
> aaa
> ? render (toStrings "aaa")
> aaa

Very cool.  Thank you.
 
> ===============================================================================
> 
> > Is there any way to convince Haskell to just resolve these numbers to
> > SOMETHING by default?  Then I can just declare that type an instance of
> > Stringable.
> 
> Unfortunately not. I did not succeed in persuading SPJ ;-). See
> 
> http://www.cs.chalmers.se/~rjmh/Haskell/Messages/Display.cgi?id=445

It sounds like he just wants more votes for this change.  I just added
mine (for whatever thats worth :-))

-Alex-

___________________________________________________________________
S. Alexander Jacobson                   i2x Media  
1-212-697-0184 voice                    1-212-697-1427 fax


Reply via email to