UP | HOME

Traits and Haskell type-classes

At this level of abstraction we focus on the common characteristics and ignore (abstract away) the differences and the irrelevant details.

Traits and type-classes are composable (can be mixed in).

OO Classes correspond to a too rigid and crude categorical thinking, while traits are composition of behaviors or characteristics in a proper duck-typing.

And, of course, implementing interfaces of a type-class is the same concept defined in different terms (well, type-classes).

Both are named sets of interfaces to be implemented to become an \(X\).

To be an \(X\) is to be able to do this and that or to have such and such characteristics.

And we are back to fundamental Set unions instead of rigid class hierarchies.

Author: <schiptsov@gmail.com>

Email: lngnmn2@yahoo.com

Created: 2023-08-08 Tue 18:31

Emacs 29.1.50 (Org mode 9.7-pre)