[Haskell-beginners] Named fields in data types
Edward Z. Yang
ezyang at MIT.EDU
Wed Nov 18 15:38:33 EST 2009
Excerpts from legajid's message of Wed Nov 18 15:11:01 -0500 2009:
> I've tried these lines :
> contact01 = Adresse "Didier" 51100 "Reims"
> contact02 = Adresse {nom="Laure", cp=0}
> contact02 = contact02 { ville="Nogent" }
>
> but i get an error : multiple declarations of Main.contact02
> So, does it mean i can't add values to contact02. Instead, i must create
> a contact03 based on contact02 ?
Yep; part of the point behind a pure functional language is to not
allow mutation by default.
Cheers,
Edward
More information about the Beginners
mailing list