Hi all,<div><br></div><div>Recently, I participated in a coding competition.</div><div>As part of it, I had to write a program wherein I had to make my data-type an instance of <span class="Apple-style-span" style="font-weight: bold;">Ord</span>. An error in my implementation of <span class="Apple-style-span" style="font-weight: bold;">compare</span> resulted in me losing quite a bit of  valuable time.   </div>
<div>As  I wrote it, I had tested it out on the ghci and it seemed to work fine but I noticed that there was trouble when the <span class="Apple-style-span" style="font-weight: bold;">List.sort</span> started giving weird output. I then noticed that for certain instances (say t1,t2),  both <span class="Apple-style-span" style="font-weight: bold;">compare t1 t2</span> AND <span class="Apple-style-span" style="font-weight: bold;">compare t2 t1</span> returned <span class="Apple-style-span" style="font-weight: bold;">LT</span>. Once I spotted it, it was easy enough to fix but I did lose an hour or so thinking something went wrong before I fed the list to the sort function.</div>
<div><br></div><div>I was the only haskeller in the competition and I believe am among the first to finish a correct application (by a large margin, and) and I did manage to raise a bit of haskell-awareness,  but if I had managed to spot the error earlier, the results would have been dazzling. </div>
<div>Does any one here have any advice on dealing with such maladroitness on the part of the programmer, especially while creating instances to type-classes? </div><div><br></div><div>Thanks and regards,</div><div>Hemanth</div>
<div><br></div><div><br></div><div><br></div><div><br></div>