[Haskell-cafe] Subclass or no subclass?

Dan Burton danburton.email at gmail.com
Sun Jun 30 19:58:15 CEST 2013


>
> I am not trying to say "every building is a shelter", rather "anything
> that is a building must provide sheltering services".


Well if it walks like a shelter and quacks like a shelter... /shrug

The "is a" relationship is not a good way to think about type classes, in
my opinion. The "interface" or "services" viewpoint is, though. Class
instances "register" a service for a certain type, and constraints are
simply a requirement that certain other services also be registered.
Usually, this is because services of the class in question invoke some of
the services listed in that class's constraints.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130630/d7af3d96/attachment.htm>


More information about the Haskell-Cafe mailing list