C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 10 of 13
Download this episode
In Chapter 10, Declaring Types and Classes, Dr. Meijer teaches us about type declarations, data declarations, arithmetic expressions, etc. In Haskell, a new name for an existing type can be defined using a
type String = [Char]
String is a synonym for the type [Char].
Like function definitions, type declarations can also have parameters. Type declarations can be nested, but
type Pos = (Int,Int)
type Trans = Pos -> Pos
type Tree = (Int,[Tree])
A completely new type can be defined by specifying its values using a data declaration:
data Bool = False | True
Bool is a new type, with two new values False and True.
Get the presentation slides here
Available formats for this video:
Actual format may change based on video formats available and browser capability.