Betr.: Re: [clean-list] records without fields

Paul de Mast demast.pjf@avans.nl
Tue, 15 Jun 2004 16:56:52 +0200


This is a MIME message. If you are reading this text, you may want to 
consider changing to a mail reader or gateway that understands how to 
properly handle MIME multipart messages.

--=__PartCDEC4F24.0__=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

>>> Bernard James POPE <bjpop@cs.mu.OZ.AU> 15-6-2004 11:53:27 >>>
>On Tue, Jun 15, 2004 at 10:52:06AM +0200, Paul de Mast wrote:
>> In the current Clean implementation records without fields are not
>> allowed. 
>> 
>> However it would be nice to be able to define records without
fields:
>> Haskell allows them so porting some Haskell code to Clean could be
>> easier and there are some situations in which records without fields
can
>> be useful. 

>Perhaps you just use an ordinary (nullary) data constructor in that
case:
>
>ie:
>
>   data Foo = Bar { }   ->   data Foo = Bar 

Correct, that is how I solved it. But now the situation of records
without fields needs to be treated as a special situation, which would
not be necessary if Clean allowed records without fields too.
 
I guess (one of) the problem(s) for records without fields is in the
typechecker which cannot derive a unique type of:
    {}
 
In Clean you can insert the type constructor to disambiguate the record
from other records:
:: R1 = {}
:: R2 = {}
 
r1 = {R1 | ...fields for r1...}  // however what if there are no
fields
r2 = {R2 | ...fields for r2...}
 
So I guess the syntax needs to be extended to support empty records
also.
 
Paul de Mast

--=__PartCDEC4F24.0__=
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Content-Description: HTML

<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">&gt;&gt;&gt; Bernard James POPE &lt;bjpop@cs.mu.OZ.AU&gt; 15-6-2004 11:53:27 &gt;&gt;&gt;<BR>
<DIV style="COLOR: #000000">&gt;On Tue, Jun 15, 2004 at 10:52:06AM +0200, Paul de Mast wrote:<BR>&gt;&gt; In the current Clean implementation records without fields are not<BR>&gt;&gt; allowed. <BR>&gt;&gt; <BR>&gt;&gt; However it would be nice to be able to define records without fields:<BR>&gt;&gt; Haskell allows them so porting some Haskell code to Clean could be<BR>&gt;&gt; easier and there are some situations in which records without fields can<BR>&gt;&gt; be useful. <BR><BR>&gt;Perhaps you just use an ordinary (nullary) data constructor in that case:<BR>&gt;<BR>&gt;ie:<BR>&gt;<BR>&gt;&nbsp;&nbsp; data Foo = Bar { }&nbsp;&nbsp; -&gt;&nbsp;&nbsp; data Foo = Bar <BR><BR>Correct, that is how I solved it. But now the situation of&nbsp;records without&nbsp;fields needs to be treated as a special situation, which would not be <SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Tahoma; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: NE">necessary </SPAN>if Clean allowed records without fields too.</DIV>
<DIV style="COLOR: #000000">&nbsp;</DIV>
<DIV style="COLOR: #000000">I guess (one of) the problem(s) for records without fields&nbsp;is in the typechecker which cannot derive&nbsp;a unique&nbsp;type of:</DIV>
<DIV style="COLOR: #000000">&nbsp;&nbsp;&nbsp; {}</DIV>
<DIV style="COLOR: #000000">&nbsp;</DIV>
<DIV style="COLOR: #000000">In Clean you can insert the type constructor to disambiguate the record from other records:</DIV>
<DIV style="COLOR: #000000">:: R1 = {}</DIV>
<DIV style="COLOR: #000000">:: R2 = {}</DIV>
<DIV style="COLOR: #000000">&nbsp;</DIV>
<DIV style="COLOR: #000000">r1 = {R1 | ...fields for r1...}&nbsp; // however what if there are no fields</DIV>
<DIV style="COLOR: #000000">r2 = {R2 | ...fields for r2...}</DIV>
<DIV style="COLOR: #000000">&nbsp;</DIV>
<DIV style="COLOR: #000000">So I guess the&nbsp;syntax needs to be extended to support empty records also.</DIV>
<DIV style="COLOR: #000000">&nbsp;</DIV>
<DIV style="COLOR: #000000">Paul de Mast</DIV></BODY></HTML>
--=__PartCDEC4F24.0__=--