idiom for different implementations of same idea

Hal Daume III hdaume@ISI.EDU
Thu, 1 Aug 2002 15:34:18 -0700 (PDT)


> > One way to do this would be to import all of the models qualified and then
> > if they choose Model0, pass to the "go" function Model0.prepareData,
> > Model0.initialize, etc.  This is fine, simple, good.  But it doesn't
> > enforce at all the types of the functions.
> 
> I don't understand what you mean by this.  Surely the "go" function is
> polymorphic over the types in the model, but requires matching types?

Right right, in the actual "driver" program the types are checked; what I
mean is that there isn't anything tying the different Model modules
together in the way that a class would.  It's not a huge differentiation,
but, eh...

> I don't think you can get Haskell to not "enforce at all the types of
> the functions".  I must be missing something.

I would hope not :)

...though there is unsafePerformIO... ;)

 - Hal