<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jun 29, 2018 at 2:51 AM, Tom Ellis <span dir="ltr"><<a href="mailto:tom-lists-haskell-cafe-2017@jaguarpaw.co.uk" target="_blank">tom-lists-haskell-cafe-2017@jaguarpaw.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, Jun 28, 2018 at 03:23:18PM -0700, Dennis Raddle wrote:<br>
> My idea was to create a typeclass, Comp, parameterized on the the<br>
> composition data structure ('comp'), the data type of a single "move" or<br>
> step to be added, ('step'), and the type of an evaluation units ('eu').<br>
> <br>
> class Comp comp eu step | comp -> eu, comp -> step where<br>
> listPossibleSteps :: comp -> [step]<br>
> addStep :: comp -> step -> comp<br>
> evalComp :: eu -> comp -> comp<br>
<br>
</span>Have you considered just making a record?<br>
<br>
data Comp comp eu step = Comp {<br>
listPossibleSteps :: comp -> [step],<br>
addStep :: comp -> step -> comp,<br>
<span class=""> evalComp :: eu -> comp -> comp<br>
}<br>
<br>
</span>If you make it a class then you end up in the bizarre situation where you<br>
can only have one collection of functionality for each type `comp`.<br>
<span class="HOEnZb"><font color="#888888"><br>
Tom</font></span></blockquote><div><br></div><div> </div></div>This in turn can be worked around using a newtype wrapper for each alternate instance you want. I like this but I understand why it is often seen as awkward.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Ryan<br></div></div>