
On Thu, Jun 28, 2018 at 03:23:18PM -0700, Dennis Raddle wrote:
My idea was to create a typeclass, Comp, parameterized on the the composition data structure ('comp'), the data type of a single "move" or step to be added, ('step'), and the type of an evaluation units ('eu').
class Comp comp eu step | comp -> eu, comp -> step where listPossibleSteps :: comp -> [step] addStep :: comp -> step -> comp evalComp :: eu -> comp -> comp
Have you considered just making a record? data Comp comp eu step = Comp { listPossibleSteps :: comp -> [step], addStep :: comp -> step -> comp, evalComp :: eu -> comp -> comp } If you make it a class then you end up in the bizarre situation where you can only have one collection of functionality for each type `comp`. Tom