Sunday, 15 March 2015

Haskell inheritance: What's inherity about it? -



Haskell inheritance: What's inherity about it? -

here http://en.wikibooks.org/wiki/haskell/classes_and_types in section class inheritance, read "a class can inherit several other classes: set ancestor classes in parentheses before =>."

i puzzled when "(...)=>" described "inheritance". far can see, it's class constraint. simply says newly defined class (in example: real) applies types members (have instances for) listed classes (num , ord).

in short, "(...)=>" seems me deed filter qualities required of types instances of class may created, , not deed augment either class or instances.

am missing something? there sense in "(...)=>" passes along "parent" "child"?

in practice, means members of subclass provide methods of superclass.

so, in linked example, can write method requires eq, give ord constraint, , eq methods implied us.

(note inheritance terrible term this, because carries lot of associations don't create sense in our context. nonetheless, figured might explain it.)

haskell inheritance

No comments:

Post a Comment