[Haskell-beginners] interface/abstract class: what is the haskell way?

Emmanuel Touzery etouzery at gmail.com
Fri Feb 8 14:31:58 CET 2013

> On Fri, Feb 08, 2013 at 01:51:26PM +0100, Emmanuel Touzery wrote:
> > But that way I must still have public getEventProvider() function which
> > returns the record, that I call by convention without some compiler
> > enforcement, which doesn't sound right.
> In some way you have to tell your program the available providers. How
> should a compiler enforce this?

It's already pretty good like that but, in an OO language basically if you
write a new such "module" you know you must implement the interface, and
that's all you need to know: the type of the interface. Then the compiler
enforces all the names of methods and return and parameter types.
So all you need to know is the name of the interface.

Here there is an "interface", the record of functions. But each module must
basically define a function returning that record. Sure, the module must
implement that function, the same as you must implement it in OO languages,
but each module can also make up its mind for the name of the function.

I mean it's basically nitpicking at this point, and it's because I'm used
to one way. I'm just used that most of the time haskell is better in
(almost) every  way to OO languages, here I think it's maybe a bit less
good, that's all.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130208/75f9923a/attachment.htm>

More information about the Beginners mailing list