In this recipe, we will look at product types. We will define simple data types with two parameters, and then will do different experiments with it.
Defining a product type
Getting ready
Create a new project called product-type using the simple Stack template:
stack new product-type simple
Change the working directory to product-type.
How to do it...
- Open src/Main.hs for editing.
- Add the following data definitions for product types:
data Product1 = Product1 Bool deriving Show
data Product2 = Product2 Bool Bool deriving Show
data Product3 a = Product3...