Please enable JavaScript.
Coggle requires JavaScript to display documents.
Programming III - Coggle Diagram
Programming III
Functions
-
Type Variables
A variable that represents any type when writing a compound variable. i.e. a
- The names of type variables must start with a lower letter
Class Constraints
A constraint on the type variables in a function's type specification that enforce them to be of the type class in the constrain
i.e. 'Num a =>' in
add :: Num a => a -> a -> a
Syntax
Naming Requirments
-
-
By convention, lists should end with s
-
Types and Classes
Types
-
-
Basic Types
Like primitive types in Java or C
i.e. Numbers, Strings, Characters, Booleans
-
Type Operators
Operators that combine basic types into compound types
Such as:
-> The function type operator
[]
Data Constructors
For every structured type, there is a data constructor (or constructor) that allows one to build larger structured values
Functors, Applicatives, Monads
Functors
Functor Laws
-
- fmap (g.h) = fmap g . fmap g