Data Types Questions and Answers¶
Types are also known as…
List three datatypes that come with Prelude.
values and types¶
Values have types. In Haskell, we cannot have an untyped value. Types are like groups that contains values that belong to that group.
Enumerate a few values that would belong to the type (a.k.a datatype)
Char and a few that would belong to the type
It is important to note that
Word includes only natural numbers,
from zero onward.
What do data declarations do?
Data declarations define types (a.k.a. data types).
basic data declaration¶
λ> :info Bool data Bool = False | True
Identify type constructors and data constructors above.
Bool is the type constructor.
True are the two
possible data constructors that belong to the type or datatype
Although we say data declaration, we are not defining __only__ data constructors. We are in fact defining both type constructors and data constructors.