<div dir="ltr">One use is when you want an open sum type rather than a closed one. For example, you might want users of your library to add their own 'constructors'. Then, they serve a purpose similar to a constructor that takes no arguments:<div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">{-# LANGUAGE EmptyDataDecls #-}</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">class Color a where</font></div><div><font face="monospace, monospace">  rgb :: a -> (Int, Int, Int)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">data Red</font></div><div><font face="monospace, monospace">data Green</font></div><div><font face="monospace, monospace">data Blue</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">instance Color Red where</font></div><div><font face="monospace, monospace">  rgb _ = (255, 0, 0)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">instance Color Green where</font></div><div><font face="monospace, monospace">  rgb _ = (0, 255, 0)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">instance Color Blue where</font></div><div><font face="monospace, monospace">  rgb _ = (0, 0, 255)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">data ColorADT = Color_Red | Color_Green | Color_Blue</font></div><div><font face="monospace, monospace">rgb_adt Color_Red   = (255, 0, 0)</font></div><div><font face="monospace, monospace">rgb_adt Color_Green = (0, 255, 0)</font></div><div><font face="monospace, monospace">rgb_adt Color_Blue  = (0, 0, 255)</font></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 12, 2016 at 8:16 AM, James Brown <span dir="ltr"><<a href="mailto:james.brown5374@gmail.com" target="_blank">james.brown5374@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">What's the purpose to a<span style="color:rgb(0,0,0);font-family:Verdana,Arial,"Bitstream Vera Sans",Helvetica,sans-serif;font-size:13px">llow data declarations with no constructors?</span></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Aug 12, 2016 at 11:08 AM, Sergey N. Yashin <span dir="ltr"><<a href="mailto:yashin.sergey@gmail.com" target="_blank">yashin.sergey@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><div dir="ltr">For zero data constructors you need to use only <a href="https://prime.haskell.org/wiki/EmptyDataDecls" target="_blank">EmptyDataDecls</a> extension.<br></div><br></span><span class="">______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/haskell-caf<wbr>e</a><br>
Only members subscribed via the mailman list are allowed to post.<br></span></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
Only members subscribed via the mailman list are allowed to post.<br></blockquote></div><br></div>