labelled fields
Hal Daume III
hdaume@ISI.EDU
Tue, 3 Jun 2003 14:32:19 -0700 (PDT)
...it's also not the same...for instance, in this new version you cannot
say:
> foo = bar { thing = Nothing }
which you could say given:
> data Foo = Foo String { thing :: Maybe String }
I'd guess that this is disallowed just for consistency. I think it would
just be too many rules to keep track of something with a combination of
multiple named fields and multiple unnamed fields.
I don't know though...
You can always give them names like "_foo1" etc., in which case ghc
probably won't warn about them, as is the case with methods whose names
begin with underscores...
- Hal
--
Hal Daume III | hdaume@isi.edu
"Arrest this man, he talks in maths." | www.isi.edu/~hdaume
On Tue, 3 Jun 2003, Steffen Mazanek wrote:
> Ok, I had missed something:
> I can write instead:
>
> data Type = TCon String (Maybe String) ...
>
> and declare a function lmtc
>
> lmtc (TCon _ x) = x
> ...
>
> But why not allow syntactic sugar?
>
> Sorry,
> Steffen
>
>
> --
> Steffen Mazanek - www.steffen-mazanek.de - GPG: 791F DCB3
>
> Haskell, that's where I just curry until fail, unwords
> any error, drop all undefined, maybe break, otherwise
> in sequence span isControl and take max $, id: (d:[])
> _______________________________________________
> Haskell mailing list
> Haskell@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>