types (type)
Haskell type system static type system, at compile time know the data type, so different types of value operations at compile time will be error, such as with Boolean and integer operation, in C language this operation will not error. Haskell supports type derivation using the: T command followed by any available expression, you can get the type of the expression, such as: T ' a ' will output ' a ':: Char indicates a is a char type.
A function also has a type, it is a good practice to give it a definite type declaration when writing a function, and there is no special difference between the parameters and the callback value. The return value is the last item, and the parameter is the first three items, such as
Addthree:: int, int, int., int
addthree x y z = x + y + Z
Int,integer all represent shaping, integer unbounded, can represent infinite number of float single precision, double doubles, BOOL Boolean, Char character, [char],string string a,b,c,d ... And so the type represented by the letter is a variable type, for example: T head looks at the type of head function, and the head is shown: [A]->a means that the head function input is a list of any variable, and the output is any variable. A good habit when writing a function is to declare the type of the function first.
type interface? type constraint? (typeclasses)
When you see this name, the direct idea is the type class, but this is not related to the class in OOP, you can regard him as an interface, that is, the type that belongs to a certain typeclasses, must realize the function of the typeclasses, it sounds very round, Because there is no contact with functional programming, so some concepts and command-style programming is not, it's okay, to the back of the understanding, I do not understand. Oh.
EQ Equality Judgment Interface
Ord contains types that can compare big
The type of show that can be represented by a string
Read is the opposite of show
Enum members are continuous types
Bounded members have upper and lower limits
This tutorial refers to the Haskell Fun Guide, which is a learning note for this guide, but has joined some of my own ideas and summaries, first of all, thanks to the author of the Haskell Guide bonus and the mainland translator Fleurer and Taiwanese translator MnO2, thank you for your previous work.