
Hi, I tried to evaluate this expression: head[[]{}] GHCi: [] Hugs: ERROR - Empty field list in update What is the correct behavior? Thanks, Vladimir

Hi Vladimir,
I don't have any answers for your questions, but what are you trying
to do that's causing you to play with the edges of the parser/type
system?
-- ryan
On Sun, May 31, 2009 at 12:41 AM, Vladimir Reshetnikov
Hi,
I tried to evaluate this expression:
head[[]{}]
GHCi: [] Hugs: ERROR - Empty field list in update
What is the correct behavior?
Thanks, Vladimir _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

head[[]{}]
GHCi: [] Hugs: ERROR - Empty field list in update
What is the correct behavior?
Seems as if GHC interprets []{} as labelled construction instead of labelled update - 3 Expressions (the grammar productions): | qcon { fbind1 , ... , fbindn } (labeled construction, n>=0) | aexp<qcon> { fbind1 , ... , fbindn } (labeled update, n >= 1) But the grammar (3.2) makes [] and () into exceptions (gcon, not qcon) gcon -> () | [] | (,{,}) | qcon (though interpreting them as nullary constructors may be more consistent..). Btw, the language report is recommended browsing for all Haskellers: http://www.haskell.org/haskellwiki/Language_and_library_specification In addition to fun puzzles like the above, it also answers many beginner questions frequently asked on this list and provides lots of small code snippets. What do I win?-) Claus
participants (3)
-
Claus Reinke
-
Ryan Ingram
-
Vladimir Reshetnikov