[Haskell-cafe] container-classes (was: Restricted type classes)
wren ng thornton
wren at freegeek.org
Mon Sep 6 23:47:30 EDT 2010
On 9/6/10 12:53 PM, John Lato wrote:
> I'd like to make one more argument in favor of my preference for more
> splitting of type classes.
FWIW, I agree that more splitting is generally good. This is one of the
problems I have with the various proposals for a ListLike class. They
conflate the cons-list like, sequence like, string like, set like (i.e.,
Boolean algebra), and collection like (e.g., filterable) functions with
nary a care. This in turn means that fewer types can implement the
class, and moreover that we can state fewer properties about the
instances which are there (e.g., what their running time complexity is
or should be).
The countervailing force, for me, is the question of whether the smaller
classes can still be well-defined--- as discussed separately in the
"Pointed" thread fork. If MPTCs are involved, the other consideration is
to make sure that type inference for common usage isn't borked by
splitting things. Even though it's a common argument from others, I
don't care about defining one instance with five methods vs five
instances with one method each. This last argument seems to be one of
the leading problems with redefining the numeric hierarchy.
More information about the Haskell-Cafe