Type Classes Flashcards
1
Q
What is the Eq class
A
Equality class provides (==) and (/=) methods. All basic data types except functions and IO are instances of this class.
2
Q
What is the Ord class
A
Equality class provides (<=) and () and (>=) methods. All basic data types except functions and IO are instances of this class.
3
Q
What is the Show class
A
Show class provides the method show :: a -> String
Can be applied by putting 'show tree' for instance. (as long as the tree class derives show) All basic data types except functions and IO are instances of this class.
4
Q
What is the Read class
A
Read class provides the method Read :: String -> a
Can be applied by putting 'show(read string :: Tree Int)' for instance. (as long as the class that the string is derives show and read). All basic data types except functions and IO are instances of this class.