
Hi What are those basic data type instances? For example here: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Bo... we have: Instances Bounded Bool Enum Bool Eq Bool Data Bool Ord Bool Read Bool Show Bool Ix Bool Typeable Bool Generic Bool Storable Bool What is the difference between, e.g., Bounded Bool and Enum Bool? -- This e-mail address is invalid, see: http://people.eisenbits.com/~stf/public-email-note.html . OpenPGP: E3D9 C030 88F5 D254 434C 6683 17DD 22A0 8A3B 5CC0

2011/12/30 Stanisław Findeisen
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. -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms

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.
Peter
2011/12/30 Stanisław Findeisen
Hi
What are those basic data type instances? For example here: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Bo... we have:
Instances
Bounded Bool Enum Bool Eq Bool Data Bool Ord Bool Read Bool Show Bool Ix Bool Typeable Bool Generic Bool Storable Bool
What is the difference between, e.g., Bounded Bool and Enum Bool?
-- This e-mail address is invalid, see: http://people.eisenbits.com/~stf/public-email-note.html .
OpenPGP: E3D9 C030 88F5 D254 434C 6683 17DD 22A0 8A3B 5CC0
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (3)
-
Brandon Allbery
-
Peter Hall
-
Stanisław Findeisen