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

Daniel Trstenjak daniel.trstenjak at gmail.com
Fri Feb 8 15:46:50 CET 2013


Hi Emmanuel,

On Fri, Feb 08, 2013 at 02:31:58PM +0100, Emmanuel Touzery wrote:
> 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.

All the type enforcement is still done on the 'EventProvider', all you
need to know is the 'EventProvider' data type, so there's not really a
difference in this regard.

> 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.

You could also name the classes implementing the interface in any way,
but will probably choose telling und helpful names.


Greetings,
Daniel



More information about the Beginners mailing list