[Haskell-cafe] Existencial Types

Luke Palmer lrpalmer at gmail.com
Tue Dec 1 16:39:17 EST 2009


On Tue, Dec 1, 2009 at 11:21 AM, David Menendez <dave at zednenem.com> wrote:
> On Tue, Dec 1, 2009 at 1:00 PM, rodrigo.bonifacio
> <rodrigo.bonifacio at uol.com.br> wrote:
>> Dear all, I wrote the following  types:
>>
>>> class Transformation t where
>>>  (<+>) :: t -> SPLModel  -> InstanceModel -> InstanceModel
>>
>>> data Configuration = forall t . Transformation t => Configuration
>>> (FeatureExpression, [t])
>>> type ConfigurationKnowledge = [Configuration]

I would suggest doing away with the class in a case like this.

data Transformation = Transformation {
    (<+>) :: SPLModel -> InstanceModel -> InstanceModel
  }

data Configuration = Configuration FeatureExpression [Transformation]

I suspect that it was OO heritage that led you to want a class here?
Forget that!  :-)

Luke


More information about the Haskell-Cafe mailing list