[Haskell-cafe] some ideas for Haskell', from Python

Manlio Perillo manlio_perillo at libero.it
Wed Jan 14 10:39:27 EST 2009


Neil Mitchell ha scritto:
> Hi
> 
>> 1) In a Python string it is available the \U{name} escape, where name is
>>   a character name in the Unicode database.
>>
>>   As an example:
>>       foo = u"abc\N{VULGAR FRACTION ONE HALF}"
> 
> Hmm, looks nice, and sensible. But as soon as you've got \N{....} syntax I want:
> 
> "foo\E{show i}bar"
> 

How this should/can work?
There is Text.Printf for this.

> i.e. embed expressions in strings. I think this would be fantastic.
> 
>> 2) In Python it is possible to import modules inside a function.
>>
>>   In Haskell something like:
>>
>>   joinPath' root name =
>>       joinPath [root, name]
>>       importing System.FilePath (joinPath)
> 
> Looks a bit ugly, but kind of useful. I'd make the syntax:
> 
> joinPath' root name = joinPath [root,name]
>   where import System.FilePath(joinPath)
> 

It seems a good solution.

> It does mean you need to read an entire file to see what functions it
> imports, 

Yes.
That's the same with Python.

I use imports inside a function only with care.
Sometime they are necessary, to avoid circular import problems (but this 
not a problem with Haskell).

 > [...]
> Nice ideas, but they probably want implemented in a Haskell compiler
> and using in real life before they are ready for Haskell' like
> thoughts.
> 

The first feature requires some works.
As far as I know GHC does not support the Unicode database at all.

It would be nice to have an Haskell interface for the CLDR (Common 
Locale Data Repository), like done in
babel: http://babel.edgewall.org/
http://unicode.org/cldr/

> Thanks
> 
> Neil
> 


Regards  Manlio Perillo



More information about the Haskell-Cafe mailing list