FP101x - week 2 Types and Classes


Type Error

ex )

> 1+ False
Error

Type in Haskell

:type in GHCi

> not False
True
> :type not False
not False :: Bool

Basic Types

List Types

Tuple Types

Function Types

Curried Functions

Polymorphic Fuctions

ex )

> length [False, True]
2
> length [1,2,3,4]
4

Overloaded Functions

ex)

> sum [1,2,3]
6
> sum [‘a’,’b’,’c’]
ERROR

Haskell has a number of type classes

ex )