You can use the : T command to detect an expression type.
A definite type must be capitalized in the first letter.
First, Types
Char
Bool
Int(bounded, high efficiency compared to integer type)
Integer(unbounded, less efficient compared to type int)
Float
Double
The type of a Tuple depends on the length and the type of the element.
The type of List depends only on the type of the element.
Second, typeclasses
"= =" represents the constraint.
Eq: Can compare equality.
Ord: can compare size.
Compare: Take two ord with the same type of value as the parameter, the result is lt,gt,eq three cases (less than/greater than/equal).
Show: Available string representation.
Show: Converts the member type in show to a string.
Read: Inverse with show.
Read: Converts a string to a member type in read. However, to identify the type of output, an ambiguous conversion cannot be performed. Read "1" is the wrong expression, and read "1":: int is the correct expression.
Enum: Represents a type that can be contiguous.
succ: Forward.
pred: successor.
bounded: have boundaries.
minbound: Lower boundary. Example, Minbound:: int expression is to see what the lower bound of the int type is.
maxbound: Upper border. Example, Maxbound:: An int expression is a view of what the upper bound of an int type is.
Num: number.
Integral: Integer. include int and integer types
floating: Floating-point numbers, including float and double types.
fromintegral: Converts the integral to num type.
Third, the understanding of types and typeclasses.
1. An expression can belong to only one type, but may belong to a variety of typeclasses.
2. To understand type, an expression can only belong to one type. To understand Typeclass as attributes, an expression can have multiple properties.
3. Expressions that belong to the same type will inevitably have the same properties. But expressions that have the same properties do not necessarily belong to the same type.
Haskell Types and Typeclasses