Yes: it becomes really easy to write partial/broken programs, e.g.:<br><br>let myEmployee = RegularEmployee "Alice"<div>    ...</div><div>    supervisor = myEmployee { salesTarget = 5.4 }</div><div><br></div><div>If you want to have both multiple constructors *and* multiple fields per constructor, I'd recommend one of the following:</div><div><br></div><div>1. Don't name the fields.</div><div>2. Use another type in between that has only one constructor, e.g. `data Supervisor = Supervisor { name :: String, salesTarget :: Double }`. A great example of this is the Node datatype[1] from xml-types.</div><div><br></div><div>[1] <a href="http://www.stackage.org/haddock/2014-11-27-ghc78-exc-1/xml-types-0.3.4/Data-XML-Types.html#t:Node">http://www.stackage.org/haddock/2014-11-27-ghc78-exc-1/xml-types-0.3.4/Data-XML-Types.html#t:Node</a></div><br><div class="gmail_quote">On Sun Dec 07 2014 at 11:37:16 AM Derek McLoughlin <<a href="mailto:derek.mcloughlin@gmail.com">derek.mcloughlin@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Record types usually have a single constructor. I've even seen blog<br>
posts that suggest that they must have a single constructor. However,<br>
multiple constructors are allowed:<br>
<br>
data Employee = RegularEmployee {<br>
                                  name :: String<br>
                             } |<br>
                             Supervisor {<br>
                                  name :: String,<br>
                                  salesTarget :: Double<br>
                             }<br>
                             Manager {<br>
                                  name :: String,<br>
                                  salesTarget :: Double<br>
                                  budget :: Double<br>
                             }<br>
<br>
I don't see this used much in Haskell code - either in explanatory<br>
books/tutorials or in code I've examined on GitHub. Are there<br>
drawbacks to using multiple constructors in this way?<br>
<br>
Derek.<br>
______________________________<u></u>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/beginners</a><br>
</blockquote></div>