2011/12/30 Stanis?aw Findeisen <stf-list at eisenbits.com>
> What is the difference between, e.g., Bounded Bool and Enum Bool?
There is only one Bool type; it is an instance of multiple typeclasses.
So, for example, it is a Bounded (meaning that there are "minBound" and
"maxBound" values associated with it) and an Enum (meaning that there are
"predecessor" and "successor" functions associated with it).
Look at the definitions of the indicated classes to see what they mean.
A reasonable analogy (though it's not nearly the same thing) for
Haskell classes is Java interfaces. e.g. in Java, Boolean is a class
that implements Serializable and Comparable, while Haskell's Bool type
is an instance of all those classes you listed. In Haskell, the
equivalent of Java's 'class Boolean implements Comparable<Boolean>
...' is 'instance Eq Bool where ... '. In Java you declare the
interfaces that a class implements when the class is declared. In
Haskell, you can add class instances to any type later, not just in
the module that declared the type.
2011/12/30 Stanis?aw Findeisen <stf-list at eisenbits.com>: