A keyword used to define a new Haskell Datatype. Involves a:
- Haskell Typeclass constructor
Typectr
for defining the type - Specific Value constructor
Valctr
to create a value of the type - A collection of components/fields with varying datatypes
data Typectr = Valctr Datatype1 Datatype2 ...
Example
data BookInfo = Book Int String [String]
deriving (Show)
- Haskell Show allows us to use the Haskell show function to get a string representation