What I would really like to see is locally scoped imports but with parameterized modules. (so modules could take types and values as parameters)
The places where I most want a feature like this is when I have a group of helper functions that need a value that is outside the modules scope, but that in general doesn't change. Usually we just curry the functions, but that generates a lot of wasted code.
A good example might be the token parsers in parsec. Rather than have something like this:
whiteSpace= P.whiteSpace lexerWe could do something like:
lexeme = P.lexeme lexer
symbol = P.symbol lexer
natural = P.natural lexer
...
"Neil Mitchell" <ndmitchell@gmail.com> writes:Why not:
>> 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}"
import Unicode.Entities as U
foo = "abc"++U.vulgar_fraction_one_half
"foo"++show i++"bar"
> Hmm, looks nice, and sensible. But as soon as you've got \N{....} syntax I want:
>
> "foo\E{show i}bar"
Change the language - save two characters.
>> 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)
> It does mean you need to read an entire file to seeWell, then you might as well allow multiple modules per file as per
the recent discussion. And multi-module files will possibly let you
achieve the desired encapsulation without actually changing the
language.
-k
--
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe