Mapa mental
Haskell
Contenido del mapa
Haskell
Commands
- :set +t
- Report types
- ghci
- Run compiler in interactive mode
- let
- Definition in local scope
- :load :r
- load and reload
- show
- Turns showable values into strings
- :set +t
Lazy
- Does least work to get answer
Polymorphism
- a
- Allow any type of input
- Items in list must be same type
- a
Type classes
- Integral
- Int or integer
- Fractional
- Floating point or double
- Ord
- Any type compared with <
- Integral
Functions
- Higher Order Function
- Function that takes another function as input
- Recursive Functions
- Functions defined in terms of themselves
- Identity function
- Works on finite lists
- Returns same value, e.g. reverse . reverse
- Higher Order Function
Syntax
- Curried Notation
- curried: a -> b -> c uncurried: (a, b) -> c
- Turns multiple arguments into 1 -returns function
- All functions in Haskell are curried
- Allows partial application
- Passing less than the full number of arguments
- Doesn't have to be defined over empty lists
- Passing less than the full number of arguments
- Lambda Abstractions
- Function without a name
- Allows creation of functions on the fly
- Good for simple calculations like 2^x
- map (\x -> 2^x) [1..20]
- Function definitions
- Pattern Matching
- safeTail [ ] = [ ] safeTail (_:xs) = xs
- Conditional
- safeTail xs = if null xs then [ ] else drop 1 xs
- Guarded
- safeTail xs | null xs = [ ] | otherwise = drop 1 xs
- Pattern Matching
- Curried Notation
Información
- Descripción
- Functional Programming Mapa Mental sobre Haskell, creado por prxd33 el 11/04/2014.
- Creado por
- prxd33
- Visitas
- 14
- Valoración
Más sobre Functional Programming and Haskell