[Haskell-cafe] Re: Suggestion: Syntactic sugar for Maps!

Jules Bean jules at jellybean.co.uk
Fri Nov 28 02:04:01 EST 2008


Don Stewart wrote:
> bulat.ziganshin:
>> Hello circ,
>>
>> Thursday, November 27, 2008, 9:59:08 PM, you wrote:
>>> So why not {"hello": 1, "there": 2} ?
>> mymap "hello:1 there:2"
>>
>> where mymap implementation is left to the reader :)

I can't see the context of the beginning of this thread, but I've always 
found:

fromList [("hello",1),("there",2)]

to be a relatively simple syntax, and still checked at compile time.

Anonymous sum + product types plus lists are a pretty good approximation 
for lots of concrete syntax, and they're type checks.

(Anonymous sum, Either, is slightly more syntactically heavy than you'd 
like, though...)

Jules


More information about the Haskell-Cafe mailing list