
If we introduce map syntax it should be overloaded. Just as list
syntax should be (and will be once I get some time to do it).
-- Lennart
On Thu, Nov 27, 2008 at 7:10 PM, Don Stewart
dons:
circularfunc:
I suggest Haskell introduce some syntactic sugar for Maps.
Python uses {"this": 2, "is": 1, "a": 1, "Map": 1}
Clojure also use braces: {:k1 1 :k2 3} where whitespace is comma but commas are also allowed.
I find the import Data.Map and then fromList [("hello",1), ("there", 2)] or the other form that I forgot(because it is to long!) to be to long...
So why not {"hello": 1, "there": 2} ?
Well, one problem is that we don't have a definitive Map library. Which kind of Map would you like? IntMap/Map/AVLTree? Some other tree?
That said, you could certainly write a little preprocessor/quasiquoting/template haskell for dictionary literals.
Perhaps overloaded *dictionary* literal syntax? So we could have
instance Dictionary Map k instance Dictionary IntMap instance Dictionary HashTable instance Dictionary Trie k
etc.
That would be pretty awesome..
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime