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

Neil Mitchell ndmitchell at gmail.com
Wed Jan 14 10:12:42 EST 2009


> 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"

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 does mean you need to read an entire file to see what functions it
imports, but perhaps that is the way it should be. I could also
imagine a syntax:

joinPath' root name = import.System.FilePath.joinPath [root,name]

i.e. doing an import and use at the same time.

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



More information about the Haskell-Cafe mailing list