syntax across languages

C.Reinke C.Reinke@ukc.ac.uk
Mon, 11 Feb 2002 18:14:30 +0000


> >   encryptionTooSimple d =  
> >     "This encryption key is too simple (must be at least "
> >     ++(show (d::Integer))++ characters long)"
> 
> - i don't like separating the string from the code for simple strings

if you don't extract the string, how can it be a parameter
of/variable in your application?

> - do you really suggest giving this translators? You can be sure it won't
>   compile any more ;p

actually, this version seems to come from an out-of-date editor
buffer (missing quote)..  it won't compile!-)

<GRIPE>
one thing I really don't like about Haskell is it's lacking
support for HERE documents, as you'll find them in shells or
in Perl. Am I the only one who's constantly bitten by this?
</GRIPE>

<ROUGH SUGGESTION>

Something like:

  encryptionTooSimple :: Integer -> String
  encryptionTooSimple d = <<HERE;
    This encryption key is too simple (must be at least $d characters long)
    HERE

with "..$var.." translated to ".."++(toString var)++".."

and toString somewhat like this (just to avoid spurious quotes):

  class Show a => ToString a where
    toString :: a -> String

  instance Show a => ToString a where
    toString = show 

  instance ToString Char where
    toString c = [c]

  instance ToString String where
    toString s = s

</ROUGH SUGGESTION>

As some of our implementers seem to be in fast-track-response mode,
perhaps this has a chance of slipping in?-)

Claus