Open klequis opened 2 years ago
Data declarations are how datatypes are defined.
Here is the data declaration for Bool which states that Bool can be True or False
Bool
True
False
-- [C] data Bool = False | True -- [A] [B] [D]
A. The type constructor for Bool, which is the datatype's name. B. Data constructor for the value False C. | (pipe) indicates "or". It is a sum type or logical disjunction D. Data constructor for the value True
|
&&
Data declarations are how datatypes are defined.
Here is the data declaration for
Bool
which states thatBool
can beTrue
orFalse
A. The type constructor for
Bool
, which is the datatype's name. B. Data constructor for the valueFalse
C.|
(pipe) indicates "or". It is a sum type or logical disjunction D. Data constructor for the valueTrue
&&
("and") which is logical conjunction