<div dir="ltr">The main reason to have distinct types is the "natural" hierarchy of the records (it's a big tree), for example, the 'C' block is roughly as follows:<div><font face="monospace"><br></font></div><div><font face="monospace" size="1">C001</font></div><div><font face="monospace" size="1">- C100</font></div><div><font face="monospace" size="1"> - C101</font></div><div><font face="monospace" size="1"> - C105</font></div><div><font face="monospace" size="1"> - C110</font></div><div><font face="monospace" size="1"> - C111</font></div><div><font face="monospace" size="1"> - C112</font></div><div><font face="monospace" size="1"> - C113</font></div><div><font face="monospace" size="1"> - C114</font></div><div><font face="monospace" size="1"> - C115</font></div><div><font face="monospace" size="1"> - C116</font></div><div><font face="monospace" size="1"> - C120</font></div><div><font face="monospace" size="1"> - C130</font></div><div><font face="monospace" size="1"> - C140</font></div><div><font face="monospace" size="1"> - C141</font></div><div><font face="monospace" size="1"> - C160</font></div><div><font face="monospace" size="1"> - C165</font></div><div><font face="monospace" size="1"> - C170</font></div><div><font face="monospace" size="1"> - C171</font></div><div><font face="monospace" size="1"> - C172</font></div><div><font face="monospace" size="1"> - C173</font></div><div><font face="monospace" size="1"> - C174</font></div><div><font face="monospace" size="1"> - C175</font></div><div><font face="monospace" size="1"> - C176</font></div><div><font face="monospace" size="1"> - C177</font></div><div><font face="monospace" size="1"> - C178</font></div><div><font face="monospace" size="1"> - C179</font></div><div><font face="monospace" size="1"> - C180</font></div><div><font face="monospace" size="1"> - C185</font></div><div><font face="monospace" size="1"> - C190</font></div><div><font face="monospace" size="1"> - C191</font></div><div><font face="monospace" size="1"> - C195</font></div><div><font face="monospace" size="1"> - C197<br></font></div><div><font face="monospace" size="1">- C300</font></div><div><font face="monospace" size="1"> - C310</font></div><div><font face="monospace" size="1"> - C320</font></div><div><font face="monospace" size="1"> - C321</font></div><div><font face="monospace" size="1"> - C330</font></div><div><font face="monospace" size="1"> - C350</font></div><div><font face="monospace" size="1"> - C370</font></div><div><font face="monospace" size="1"> - C380</font></div><div><font face="monospace" size="1"> - C390</font></div><div><font face="monospace" size="1">- C400</font></div><div><font face="monospace" size="1"> - C405</font></div><div><font face="monospace" size="1"> - C410</font></div><div><font face="monospace" size="1"> - C420</font></div><div><font face="monospace" size="1"> - C425</font></div><div><font face="monospace" size="1"> - C430</font></div><div><font face="monospace" size="1"> - C460</font></div><div><font face="monospace" size="1"> - C465</font></div><div><font face="monospace" size="1"> - C470</font></div><div><font face="monospace" size="1"> - C480</font></div><div><font face="monospace" size="1"> - C490</font></div><div><font face="monospace" size="1">- C495</font></div><div><font face="monospace" size="1">- C500</font></div><div><font face="monospace" size="1"> - C510</font></div><div><font face="monospace" size="1"> - C590</font></div><div><font face="monospace" size="1"> - C591</font></div><div><font face="monospace" size="1"> - C595</font></div><div><font face="monospace" size="1"> - C597</font></div><div><font face="monospace" size="1">- C600</font></div><div><font face="monospace" size="1"> - C601</font></div><div><font face="monospace" size="1"> - C610</font></div><div><font face="monospace" size="1"> - C690</font></div><div><font face="monospace" size="1">- C700</font></div><div><font face="monospace" size="1"> - C790</font></div><div><font face="monospace" size="1"> - C791</font></div><div><font face="monospace" size="1">- C800</font></div><div><font face="monospace" size="1"> - C810</font></div><div><font face="monospace" size="1"> - C815</font></div><div><font face="monospace" size="1"> - C850</font></div><div><font face="monospace" size="1">- C860</font></div><div><font face="monospace" size="1"> - C870</font></div><div><font face="monospace" size="1"> - C880</font></div><div><font face="monospace" size="1"> - C890</font></div><div><span style="font-family:monospace"><font size="1">C990</font></span></div><div><span style="font-family:monospace"><font size="1"><br></font></span></div><div><font size="1" style="" face="arial, sans-serif">There is more blocks that form the whole document (or tree), Blocks: </font><font size="1" style="" face="monospace">0, B, C, D, E, G, H, K, I, 9</font></div><div><br></div><div><font face="arial, sans-serif">The idea is to parse the document and implement manipulation functions to edit the content and later export in other formats</font></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 30, 2020 at 6:56 AM Jon Fairbairn <<a href="mailto:jon.fairbairn@cl.cam.ac.uk">jon.fairbairn@cl.cam.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Jean Lopes <<a href="mailto:hawu.bnu@gmail.com" target="_blank">hawu.bnu@gmail.com</a>> writes:<br>
<br>
> Hi!<br>
><br>
> I'm trying to encode a domain which is full of simple records, and a lot of<br>
> field name clashes.<br>
><br>
> Here is a simple example, a.k.a. 1:1 with the domain-spec:<br>
><br>
> data C001 {<br>
>> -- other stuff<br>
>> indMov :: Bool<br>
>> }<br>
>> data C170 {<br>
>> -- other stuff<br>
>> indMov :: Bool<br>
>> }<br>
><br>
><br>
> There is ~148 records with this field (indMov), all with the same meaning.<br>
> What are my options to encode this in Haskell?<br>
<br>
Is there some reason why they must be different types?<br>
<br>
data C = C001 {other_stuff:: Real, indMov:: Bool } |<br>
C170 {other_stuff…, indMov:: Bool }<br>
<br>
is the first thing that comes to mind.<br>
-- <br>
Jón Fairbairn <a href="mailto:Jon.Fairbairn@cl.cam.ac.uk" target="_blank">Jon.Fairbairn@cl.cam.ac.uk</a><br>
<br>
<br>
_______________________________________________<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-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div>