SlideShare una empresa de Scribd logo
1 de 300
Descargar para leer sin conexión
“Funneverstops.
IntroductiontoHaskell
Programminglanguage”
twitter: @rabbitonweb,
github: github.com/rabbitonweb
“Funneverstops.
IntroductiontoHaskell
Programminglanguage”
twitter: @rabbitonweb,
github: github.com/rabbitonweb
FOR SCALA
DEVELOPERS
WhylearnHaskell
???
TherearetwotypesofScaladevelopers:
TherearetwotypesofScaladevelopers:
1)thosewhoarehappytheynolongerprograminJava
TherearetwotypesofScaladevelopers:
1)thosewhoarehappytheynolongerprograminJava
2)ThoseWhoarepissedofftheyarenotyetusinghaskell
TherearetwotypesofScaladevelopers:
1)thosewhoarehappytheynolongerprograminJava
2)ThoseWhoarepissedofftheyarenotyetusinghaskell
Let’s get a bit of that Haskell taste...
WhylearnHaskell?
WhylearnHaskell?
HaskellisPureFunctional
ProgrammingLanguage
WhatisFunctionalProgramming?
❏ no assignment statements
WhatisFunctionalProgramming?
❏ no assignment statements
❏ no variables
WhatisFunctionalProgramming?
❏ no assignment statements
❏ no variables
❏ once given a value, never change
WhatisFunctionalProgramming?
❏ no assignment statements
❏ no variables
❏ once given a value, never change
❏ no side-effects at all
WhatisFunctionalProgramming?
❏ no assignment statements
❏ no variables
❏ once given a value, never change
❏ no side-effects at all
WhatisFunctionalProgramming?
❏ no assignment statements
❏ no variables
❏ once given a value, never change
❏ no side-effects at all
WhatisFunctionalProgramming?
❏ no assignment statements
❏ no variables
❏ once given a value, never change
❏ no side-effects at all
WhatisFunctionalProgramming?
❏ no assignment statements
❏ no variables
❏ once given a value, never change
❏ no side-effects at all
WhatisFunctionalProgramming?
WhatisFunctionalProgramming?
❏ no assignment statements
❏ no variables
❏ once given a value, never change
❏ no side-effects at all
“The functional programmer sounds
rather like a mediæval monk,
denying himself the pleasures of
life in the hope that it will make
him virtuous.”
WhyFunctionalProgrammingMatters?
WhyFunctionalProgrammingMatters?
What procedural programming,
dependency injection, actor
model, microservices and
clean architecture have in
common?
WhyFunctionalProgrammingMatters?
What procedural programming,
dependency injection, actor
model, microservices and
clean architecture have in
common?
WhyFunctionalProgrammingMatters?
❏ We strive for modularity
What procedural programming,
dependency injection, actor
model, microservices and
clean architecture have in
common?
f(input): output
input f(input): output
input f(input): output output
input f(input): output output g(input): output
input f(input): output output g(input): output output
h = g o f
input f(input): output output g(input): output output
WhyFunctionalProgrammingMatters?
❏ We strive for modularity
WhyFunctionalProgrammingMatters?
❏ We strive for modularity
❏ There is no concept of time
Whatwillthisfunctiondo?
/**
* This function returns a reversed list
* @param list A list to be reversed
* @return A reversed list
*/
def reverse[T](list: List[T]): List[T] = ???
Whatwillthisfunctiondo?
/**
* This function returns a reversed list
* @param list A list to be reversed
* @return A reversed list
*/
def reverse[T](list: List[T]): List[T] = ???
Whatwillthisfunctiondo?
/**
* This function returns a reversed list
* @param list A list to be reversed
* @return A reversed list
def reverse[T](list: List[T]): List[T] = ???
Whatwillthisfunctiondo?
/**
* This function returns a reversed list
* @param list A list to be reversed
def reverse[T](list: List[T]): List[T] = ???
Whatwillthisfunctiondo?
/**
* This function returns a reversed list
def reverse[T](list: List[T]): List[T] = ???
Whatwillthisfunctiondo?
/**
def reverse[T](list: List[T]): List[T] = ???
Whatwillthisfunctiondo?
def reverse[T](list: List[T]): List[T] = ???
Whatwillthisfunctiondo?
def reverse[T](list: List[T]): List[T] = list.sort
Whatwillthisfunctiondo?
Whatwillthisfunctiondo?
def rhrggahaham[A](a: A): A = ???
Whatwillthisfunctiondo?
def rhrggahaham[A](a: A): A = ???
Ifwrittenbyfunctionalprogrammer
Whatwillthisfunctiondo?
def rhrggahaham[A](a: A): A = ???
Whatwillthisfunctiondo?
def rhrggahaham[A](a: A): A = a
Whatwillthisfunctiondo?
def identity[A](a: A): A = a
Whatwillthisfunctiondo?
def rhrggahaham[A](a: A): A = a
Whatwillthisfunctiondo?
def rhrggahaham[A](a: A): A = a
Whatwillthisfunctiondo?
def rhrggahaham[A](a: A): A = a
Whatwillthisfunctiondo?
def rhrggahaham(a: Int): Int = ???
Whatwillthisfunctiondo?
def rhrggahaham(a: Int): Int = ???
Ifwrittenbyfunctionalprogrammer
Whatwillthisfunctiondo?
def rhrggahaham(a: Int): Int = a
a + 10
20
WhyFunctionalProgrammingMatters?
❏ We strive for modularity
❏ There is no concept of time
WhyFunctionalProgrammingMatters?
❏ We strive for modularity
❏ There is no concept of time
❏ We can reason about our code
with ease
def curry
scala> def add(a: Int, b: Int) = a + b
add: (a: Int, b: Int)Int
scala> def add(a: Int, b: Int) = a + b
add: (a: Int, b: Int)Int
scala> val curriedAdd = curry(add)
curriedAdd: Int => (Int => Int) = <function1>
scala> def add(a: Int, b: Int) = a + b
add: (a: Int, b: Int)Int
scala> val curriedAdd = curry(add)
curriedAdd: Int => (Int => Int) = <function1>
scala> val add5 = curriedAdd(5)
scala> add5(7)
res1: Int = 12
def curry
def curry[A,B,C](f: (A, B) => C):
def curry[A,B,C](f: (A, B) => C): (A => (B => C)) =
def curry[A,B,C](f: (A, B) => C): (A => (B => C)) =
(a: A) => ?
def curry[A,B,C](f: (A, B) => C): (A => (B => C)) =
(a: A) => ( ? => ? )
def curry[A,B,C](f: (A, B) => C): (A => (B => C)) =
(a: A) => ( (b: B) => ? )
def curry[A,B,C](f: (A, B) => C): (A => (B => C)) =
(a: A) => ( (b: B) => f(a,b) )
WhyFunctionalProgrammingMatters?
❏ We strive for modularity
❏ There is no concept of time
❏ We can reason about our code
with ease
WhyFunctionalProgrammingMatters?
❏ We strive for modularity
❏ There is no concept of time
❏ We can reason about our code
with ease
❏ Just follow types
WhyFunctionalProgrammingMatters?
❏ We strive for modularity
❏ There is no concept of time
❏ We can reason about our code
with ease
❏ Just follow types
❏ Lazy evaluation
WhyFunctionalProgrammingMatters?
❏ We strive for modularity
❏ There is no concept of time
❏ We can reason about our code
with ease
❏ Just follow types
❏ Lazy evaluation
WhylearnHaskell
???
WhylearnHaskell?
HaskellisPureFunctional
ProgrammingLanguage
WhylearnHaskell?
HaskellisPureFunctional
ProgrammingLanguage
WhylearnHaskell?
HaskellisPureFunctional
ProgrammingLanguage
https://xkcd.com/1312/
World-> (World,A)
World-> (World,A)
"aninteractiveprogramisapurefunctionthattakesthe
current'stateoftheworld'asitsarg.andproducesa
modifiedworldasresult"
World-> (World,A)
“Protip:Don'ttrytotrackreal-worldstateinyourcode.
Insteadtakeitasanargument,sinceonlytheworld
knowswhatstateit'sin.”
World->(World,A)
World->(World,A)
PURE
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
World->(World,A)
IMPURE
World->(World,A)
World->(World,A)
f
World->(World,A)
currentStateOfTheWorld = stateOfTheWorld
f
World->(World,A)
currentStateOfTheWorld = stateOfTheWorld
= f currentStateOfTheWorld
f
World->(World,A)
currentStateOfTheWorld = stateOfTheWorld
= f currentStateOfTheWorld
f
World->(World,A)
currentStateOfTheWorld = stateOfTheWorld
= f currentStateOfTheWorld
f
World->(World,A)
currentStateOfTheWorld = stateOfTheWorld
= f currentStateOfTheWorld
f
World->(World,A)
currentStateOfTheWorld = stateOfTheWorld
= f currentStateOfTheWorld
f
World->(World,A)
currentStateOfTheWorld = stateOfTheWorld
(newWorld, someValue) = f currentStateOfTheWorld
f
World->(World,A)
currentStateOfTheWorld = stateOfTheWorld
(newWorld, someValue) = f currentStateOfTheWorld
modifyWorldWith newWorld
f
World->(World,A)
currentStateOfTheWorld = stateOfTheWorld
(newWorld, someValue) = f currentStateOfTheWorld
modifyWorldWith newWorld
display someValue
f
JustaLittlebitof
history
HaskellHistoryinanutshell
HaskellHistoryinanutshell
❏ Miranda released 1985 - de facto FP ‘standard’
HaskellHistoryinanutshell
❏ Miranda released 1985 - de facto FP ‘standard’
❏ At the FPCA'87 few formed a consensus that an open
standard should be defined for FP languages
HaskellHistoryinanutshell
❏ Miranda released 1985 - de facto FP ‘standard’
❏ At the FPCA'87 few formed a consensus that an open
standard should be defined for FP languages
❏ Haskell 1.0 defined in 1990
HaskellHistoryinanutshell
❏ Miranda released 1985 - de facto FP ‘standard’
❏ At the FPCA'87 few formed a consensus that an open
standard should be defined for FP languages
❏ Haskell 1.0 defined in 1990
❏ Haskell 98 in late 1997
HaskellHistoryinanutshell
❏ Miranda released 1985 - de facto FP ‘standard’
❏ At the FPCA'87 few formed a consensus that an open
standard should be defined for FP languages
❏ Haskell 1.0 defined in 1990
❏ Haskell 98 in late 1997
“(...) intended to specify a stable, minimal, portable
version of the language and an accompanying standard library
for teaching, and as a base for future extensions.”
HaskellHistoryinanutshell
❏ Miranda released 1985 - de facto FP ‘standard’
❏ At the FPCA'87 few formed a consensus that an open
standard should be defined for FP languages
❏ Haskell 1.0 defined in 1990
❏ Haskell 98 in late 1997
HaskellHistoryinanutshell
❏ Miranda released 1985 - de facto FP ‘standard’
❏ At the FPCA'87 few formed a consensus that an open
standard should be defined for FP languages
❏ Haskell 1.0 defined in 1990
❏ Haskell 98 in late 1997
❏ “The Haskell 98 Report” in 1999
HaskellHistoryinanutshell
❏ Miranda released 1985 - de facto FP ‘standard’
❏ At the FPCA'87 few formed a consensus that an open
standard should be defined for FP languages
❏ Haskell 1.0 defined in 1990
❏ Haskell 98 in late 1997
❏ “The Haskell 98 Report” in 1999
❏ “The Haskell 2010 Report” in 2009/2010
HaskellHistoryinanutshell
❏ Miranda released 1985 - de facto FP ‘standard’
❏ At the FPCA'87 few formed a consensus that an open
standard should be defined for FP languages
❏ Haskell 1.0 defined in 1990
❏ Haskell 98 in late 1997
❏ “The Haskell 98 Report” in 1999
❏ “The Haskell 2010 Report” in 2009/2010
❏ Further Haskell evolves rapidly around GHC
Showussomecode
already!
GHC-GlassgowHaskellCompiler
GHC-GlassgowGloriousHaskellCompiler
GHC-GlassgowGloriousHaskellCompiler
❏ > ghci
❏ :t
❏ +set :t
❏ :load
❏ Emacs + Haskell mode
❏ C-c C-b
❏ C-c C-l
FunWithFunctions
FunWithFunctions
helloWorld = “Hello World”
FunWithFunctions
❏ function without parameters is called definition
helloWorld = “Hello World”
FunWithFunctions
❏ function without parameters is called definition
❏ function name must start with small letter
helloWorld = “Hello World”
FunWithFunctions
❏ function without parameters is called definition
❏ function name must start with small letter
> helloWorld
"Hello World"
it :: [Char]
helloWorld = “Hello World”
FunWithFunctions
FunWithFunctions
london u = “London “ ++ u
FunWithFunctions
> :t london
london :: [Char] -> [Char]
london u = “London “ ++ u
FunWithFunctions
> :t london
london :: [Char] -> [Char]
> london "baby"
"london baby"
it :: [Char]
london u = “London “ ++ u
FunWithFunctions
> :t london
london :: [Char] -> [Char]
> london "baby"
"london baby"
it :: [Char]
london :: [Char] -> [Char]
london u = “London “ ++ u
FunWithFunctions
isA c = c == 'A'
FunWithFunctions
isA :: Char -> Bool
isA c = c == 'A'
FunWithFunctions
> isA 'd'
False
> isA 'A'
True
isA :: Char -> Bool
isA c = c == 'A'
FunWithFunctions
FunWithFunctions
prefixMe c str = [c] ++ " " ++ str
FunWithFunctions
> prefixMe '_' "word"
"_ word"
it :: [Char]
prefixMe c str = [c] ++ " " ++ str
FunWithFunctions
> :t prefixMe
prefixMe :: Char -> [Char] -> [Char]
> prefixMe '_' "word"
"_ word"
it :: [Char]
prefixMe c str = [c] ++ " " ++ str
FunWithFunctions
> :t prefixMe
prefixMe :: Char -> ([Char] -> [Char])
> prefixMe '_' "word"
"_ word"
it :: [Char]
prefixMe c str = [c] ++ " " ++ str
FunWithFunctions
FunWithFunctions
answerToEverything = 42
FunWithFunctions
answerToEverything = 42
complexCalc x y z = x * y * z * answerToEverything
FunWithFunctions
> :t complexCalc
complexCalc :: Integer -> Integer -> Integer -> Integer
answerToEverything = 42
complexCalc x y z = x * y * z * answerToEverything
FunWithFunctions
> :t complexCalc
complexCalc :: Integer -> Integer -> Integer -> Integer
complexCalc :: Integer -> (Integer -> (Integer -> Integer))
answerToEverything = 42
complexCalc x y z = x * y * z * answerToEverything
FunWithFunctions
> :t complexCalc
complexCalc :: Integer -> Integer -> Integer -> Integer
complexCalc :: Integer -> (Integer -> (Integer -> Integer))
> complexCalc 10 20 30
answerToEverything = 42
complexCalc x y z = x * y * z * answerToEverything
FunWithFunctions
> :t complexCalc
complexCalc :: Integer -> Integer -> Integer -> Integer
complexCalc :: Integer -> (Integer -> (Integer -> Integer))
> complexCalc 10 20 30
> ((complexCalc 10) 20) 30
answerToEverything = 42
complexCalc x y z = x * y * z * answerToEverything
FunWithTypes
FunWithTypes
❏ We’ve already seen: Char, Integers & Bool
FunWithTypes
❏ We’ve already seen: Char, Integers & Bool
❏ Other build-in types:
FunWithTypes
❏ We’ve already seen: Char, Integers & Bool
❏ Other build-in types:
❏ Int, Float, Doubles
FunWithTypes
❏ We’ve already seen: Char, Integers & Bool
❏ Other build-in types:
❏ Int, Float, Doubles
❏ Tuples
FunWithTypes
❏ We’ve already seen: Char, Integers & Bool
❏ Other build-in types:
❏ Int, Float, Doubles
❏ Tuples
> (False, "Is it?")
it :: (Bool, [Char])
> (10.4, True, "Values", 'Y')
it :: (Double, Bool, [Char], Char)
FunWithTypes
❏ We’ve already seen: Char, Integers & Bool
❏ Other build-in types:
❏ Int, Float, Doubles
❏ Tuples
FunWithTypes
❏ We’ve already seen: Char, Integers & Bool
❏ Other build-in types:
❏ Int, Float, Doubles
❏ Tuples
❏ Lists
> [False, False, True]
it :: [Bool]
> [10, 20, 30]
it :: [Integer]
> ["one", "two", "three"]
it :: [[Char]]
Polymorphic types
Polymorphic types
> length [False, False, True]
3
Polymorphic types
> length [False, False, True]
3
> length [10, 20, 30, 40]
4
Polymorphic types
> length [False, False, True]
3
> length [10, 20, 30, 40]
4
> length ["one", "two", "three"]
3
Polymorphic types
> length [False, False, True]
3
> length [10, 20, 30, 40]
4
> length ["one", "two", "three"]
3
length :: [a] -> Int
Polymorphic types
> length [False, False, True]
3
> length [10, 20, 30, 40]
4
> length ["one", "two", "three"]
3
length :: [a] -> Int
‘a’ is a type variable, which means that length can be
applied to list of any type
List101
List101
numbers = [1, 3, 5, 7]
List101
numbers = [1, 3, 5, 7]
numbers !! 2 -> 5
List101
numbers = [1, 3, 5, 7]
numbers !! 2 -> 5
null numbers -> False
List101
numbers = [1, 3, 5, 7]
numbers !! 2 -> 5
null numbers -> False
head numbers -> 1
List101
numbers = [1, 3, 5, 7]
numbers !! 2 -> 5
null numbers -> False
head numbers -> 1
tail numbers -> [3, 5, 7]
List101
numbers = [1, 3, 5, 7]
numbers !! 2 -> 5
null numbers -> False
head numbers -> 1
tail numbers -> [3, 5, 7]
init numbers -> [1, 3, 5]
List101
numbers = [1, 3, 5, 7]
numbers !! 2 -> 5
null numbers -> False
head numbers -> 1
tail numbers -> [3, 5, 7]
init numbers -> [1, 3, 5]
last numbers -> 7
List101
numbers = [1, 3, 5, 7]
numbers !! 2 -> 5
null numbers -> False
head numbers -> 1
tail numbers -> [3, 5, 7]
init numbers -> [1, 3, 5]
last numbers -> 7
drop 2 numbers -> [5, 7]
List101
numbers = [1, 3, 5, 7]
numbers !! 2 -> 5
null numbers -> False
head numbers -> 1
tail numbers -> [3, 5, 7]
init numbers -> [1, 3, 5]
last numbers -> 7
drop 2 numbers -> [5, 7]
take 2 numbers -> [1, 3]
List101
numbers = [1, 3, 5, 7]
numbers !! 2 -> 5
null numbers -> False
head numbers -> 1
tail numbers -> [3, 5, 7]
init numbers -> [1, 3, 5]
last numbers -> 7
drop 2 numbers -> [5, 7]
take 2 numbers -> [1, 3]
elem 5 numbers -> True
List101
List101
[1..6] -> [1, 2, 3, 4, 5, 6]
List101
[1..6] -> [1, 2, 3, 4, 5, 6]
[1,3,.., 20] -> [1,3,5,7,9,11,13,15,17,19]
List101
[1..6] -> [1, 2, 3, 4, 5, 6]
[1,3,.., 20] -> [1,3,5,7,9,11,13,15,17,19]
[1..] -> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...
List101
[1..6] -> [1, 2, 3, 4, 5, 6]
[1,3,.., 20] -> [1,3,5,7,9,11,13,15,17,19]
take 5 [1..] -> [1, 2, 3, 4, 5]
List101
[1..6] -> [1, 2, 3, 4, 5, 6]
[1,3,.., 20] -> [1,3,5,7,9,11,13,15,17,19]
take 5 [1..] -> [1, 2, 3, 4, 5]
(cycle [0, 1]) -> [0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,..
List101
[1..6] -> [1, 2, 3, 4, 5, 6]
[1,3,.., 20] -> [1,3,5,7,9,11,13,15,17,19]
take 5 [1..] -> [1, 2, 3, 4, 5]
take 6 (cycle [0, 1]) -> [0,1,0,1,0,1]
List101
[1..6] -> [1, 2, 3, 4, 5, 6]
[1,3,.., 20] -> [1,3,5,7,9,11,13,15,17,19]
take 5 [1..] -> [1, 2, 3, 4, 5]
take 6 (cycle [0, 1]) -> [0,1,0,1,0,1]
take 3 (repeat 2) -> [2, 2, 2]
List101
List101
[2 ^ x | x <- [1..5]] -> [2,4,8,16,32]
List101
[2 ^ x | x <- [1..5]] -> [2,4,8,16,32]
take 7 [2 ^ x | x <- [1..]] -> [2,4,8,16,32,64,128]
List101
[2 ^ x | x <- [1..5]] -> [2,4,8,16,32]
take 7 [2 ^ x | x <- [1..]] -> [2,4,8,16,32,64,128]
[(x,y) | x <- [1..5], y <- [1..5]] -> [(1,1),(1,2),(1,3), ...
List101
[2 ^ x | x <- [1..5]] -> [2,4,8,16,32]
take 7 [2 ^ x | x <- [1..]] -> [2,4,8,16,32,64,128]
[(x,y) | x <- [1..5], y <- [1..5]] -> [(1,1),(1,2),(1,3), …
[(x,y) | x <- [1..2], y <- [x..2]] -> [(1,1),(1,2),(2,2)]
List101
[2 ^ x | x <- [1..5]] -> [2,4,8,16,32]
take 7 [2 ^ x | x <- [1..]] -> [2,4,8,16,32,64,128]
[(x,y) | x <- [1..5], y <- [1..5]] -> [(1,1),(1,2),(1,3), ...
[(x,y) | x <- [1..2], y <- [x..2]] -> [(1,1),(1,2),(2,2)]
[x | x <- [1..7], x `mod` 2 == 0] -> [2, 4, 6]
List101
[2 ^ x | x <- [1..5]] -> [2,4,8,16,32]
take 7 [2 ^ x | x <- [1..]] -> [2,4,8,16,32,64,128]
[(x,y) | x <- [1..5], y <- [1..5]] -> [(1,1),(1,2),(1,3), ...
[(x,y) | x <- [1..2], y <- [x..2]] -> [(1,1),(1,2),(2,2)]
[x | x <- [1..7], x `mod` 2 == 0] -> [2, 4, 6]
zip "abc" [1,2,3] -> [('a',1),('b',2),('c',3)]
List101
[2 ^ x | x <- [1..5]] -> [2,4,8,16,32]
take 7 [2 ^ x | x <- [1..]] -> [2,4,8,16,32,64,128]
[(x,y) | x <- [1..5], y <- [1..5]] -> [(1,1),(1,2),(1,3), ...
[(x,y) | x <- [1..2], y <- [x..2]] -> [(1,1),(1,2),(2,2)]
[x | x <- [1..7], x `mod` 2 == 0] -> [2, 4, 6]
zip "abc" [1,2,3] -> [('a',1),('b',2),('c',3)]
zip "abc" (cycle [0,1]) -> [('a',0),('b',1),('c',0)]
List101
[2 ^ x | x <- [1..5]] -> [2,4,8,16,32]
take 7 [2 ^ x | x <- [1..]] -> [2,4,8,16,32,64,128]
[(x,y) | x <- [1..5], y <- [1..5]] -> [(1,1),(1,2),(1,3), ...
[(x,y) | x <- [1..2], y <- [x..2]] -> [(1,1),(1,2),(2,2)]
[x | x <- [1..7], x `mod` 2 == 0] -> [2, 4, 6]
zip "abc" [1,2,3] -> [('a',1),('b',2),('c',3)]
zip "abc" (cycle [0,1]) -> [('a',0),('b',1),('c',0)]
zipWith (+) [1,2,3] [4,5,6] -> [5,7,9]
Classes
Classes
caseclassFoo(...)???
Classes
caseclassFoo(...)???
No,notthoseclasses.Typeclasses.
TypeClasses
Type class is a set of types which support certain
collection of functions defined by the class.
TypeClasses
❏ Eq
TypeClasses
❏ Eq
(==) :: a -> a -> Bool; (/=) :: a -> a -> Bool
TypeClasses
❏ Eq
(==) :: a -> a -> Bool; (/=) :: a -> a -> Bool
❏ Ord
TypeClasses
❏ Eq
(==) :: a -> a -> Bool; (/=) :: a -> a -> Bool
❏ Ord
< , <= , > , >= :: a -> a -> Bool; min , max :: a -> a -> a
TypeClasses
❏ Eq
(==) :: a -> a -> Bool; (/=) :: a -> a -> Bool
❏ Ord
< , <= , > , >= :: a -> a -> Bool; min , max :: a -> a -> a
❏ Show
TypeClasses
❏ Eq
(==) :: a -> a -> Bool; (/=) :: a -> a -> Bool
❏ Ord
< , <= , > , >= :: a -> a -> Bool; min , max :: a -> a -> a
❏ Show
show :: a -> String
TypeClasses
❏ Eq
(==) :: a -> a -> Bool; (/=) :: a -> a -> Bool
❏ Ord
< , <= , > , >= :: a -> a -> Bool; min , max :: a -> a -> a
❏ Show
show :: a -> String
❏ Read
TypeClasses
❏ Eq
(==) :: a -> a -> Bool; (/=) :: a -> a -> Bool
❏ Ord
< , <= , > , >= :: a -> a -> Bool; min , max :: a -> a -> a
❏ Show
show :: a -> String
❏ Read
read :: String -> a
TypeClasses
> 10 == 20
False
TypeClasses
> 10 == 20
False
> 10 < 20
True
TypeClasses
> 10 == 20
False
> 10 < 20
True
> show 1 ++ " is a number"
"1 is a number"
TypeClasses
> 10 == 20
False
> 10 < 20
True
> show 1 ++ " is a number"
"1 is a number"
> read "5" + 10
15
TypeClasses
> 10 == 20
False
> 10 < 20
True
> show 1 ++ " is a number"
"1 is a number"
> read "5" + 10
15
> read "5"
<interactive>:85:1:
No instance for (Read a0) arising from a use of `read'
*Main> read "5" :: Integer 5 it :: Integer
TypeClasses
> 10 == 20
False
> 10 < 20
True
> show 1 ++ " is a number"
"1 is a number"
> read "5" + 10
15
> read "5" :: Integer
5
Typeclasses&classconstraints
add a b = a + b
Typeclasses&classconstraints
add :: Num a => a -> a -> a
add a b = a + b
Typeclasses&classconstraints
add :: Num a => a -> a -> a
add a b = a + b
add 10 20
Typeclasses&classconstraints
add :: Num a => a -> a -> a
add a b = a + b
add 10 20
add 5.0 7.0
Typeclasses&classconstraints
add :: Num a => a -> a -> a
add a b = a + b
add 10 20
add 5.0 7.0
weirdo n d str = (n + 2, d / 2.0, str ++ "!!")
Typeclasses&classconstraints
add :: Num a => a -> a -> a
add a b = a + b
add 10 20
add 5.0 7.0
weirdo :: (Fractional t1, Num t) =>
t -> t1 -> [Char] -> (t, t1, [Char])
weirdo n d str = (n + 2, d / 2.0, str ++ "!!")
Typeclasses&classconstraints
add :: Num a => a -> a -> a
add a b = a + b
add 10 20
add 5.0 7.0
weirdo :: (Fractional t1, Num t) =>
t -> t1 -> [Char] -> (t, t1, [Char])
weirdo n d str = (n + 2, d / 2.0, str ++ "!!")
weirdo 7 7.0 “kuku”
Typeclasses&classconstraints
add :: Num a => a -> a -> a
add a b = a + b
add 10 20
add 5.0 7.0
weirdo :: (Fractional t1, Num t) =>
t -> t1 -> [Char] -> (t, t1, [Char])
weirdo n d str = (n + 2, d / 2.0, str ++ "!!")
weirdo 7 7.0 “kuku”
weirdo 7.0 5.0 “mono”
FunWithFunctions,Part2
sum :: Num a => [a] -> a
FunWithFunctions,Part2
sum :: Num a => [a] -> a
sum list = if null list then 0
else 1 + sum (tail list)
FunWithFunctions,Part2
sum :: Num a => [a] -> a
FunWithFunctions,Part2
sum :: Num a => [a] -> a
sum [] = 0
FunWithFunctions,Part2
sum :: Num a => [a] -> a
sum [] = 0
sum x:xs = 1 + sum xs
FunWithFunctions,Part2
programmingLanguage :: [Char] -> [Char]
FunWithFunctions,Part2
programmingLanguage :: [Char] -> [Char]
programmingLanguage "Scala" = "Good"
FunWithFunctions,Part2
programmingLanguage :: [Char] -> [Char]
programmingLanguage "Scala" = "Good"
programmingLanguage "Haskell" = "Even better!"
FunWithFunctions,Part2
programmingLanguage :: [Char] -> [Char]
programmingLanguage "Scala" = "Good"
programmingLanguage "Haskell" = "Even better!"
programmingLanguage other = "Meh..." ++ other ++ ", pf.."
FunWithFunctions,Part2
first :: (a, b, c) -> a
first (x, _, _) = x
second :: (a, b, c) -> b
second (_, y, _) = y
third :: (a, b, c) -> c
third (_, _, z) = z
FunWithFunctions,Part2
rankMe :: (Num a, Ord a) => a -> [Char]
FunWithFunctions,Part2
rankMe :: (Num a, Ord a) => a -> [Char]
rankMe lines
FunWithFunctions,Part2
rankMe :: (Num a, Ord a) => a -> [Char]
rankMe lines
| lines > 100 = "Senior"
FunWithFunctions,Part2
rankMe :: (Num a, Ord a) => a -> [Char]
rankMe lines
| lines > 100 = "Senior"
| lines > 30 = "Regular"
FunWithFunctions,Part2
rankMe :: (Num a, Ord a) => a -> [Char]
rankMe lines
| lines > 100 = "Senior"
| lines > 30 = "Regular"
| lines >= 0 = "Junior"
FunWithFunctions,Part2
rankMe :: (Num a, Ord a) => a -> [Char]
rankMe lines
| lines > 100 = "Senior"
| lines > 30 = "Regular"
| lines >= 0 = "Junior"
| lines < 0 = "Congrats! You are a true Hacker!"
FunWithFunctions,Part2
rankMe :: (Num a, Ord a) => a -> a -> a -> [Char]
rankMe added deleted modified
| lines > 100 = "Senior"
| lines > 30 = "Regular"
| lines >= 0 = "Junior"
| lines < 0 = "Congrats! You are a true Hacker!"
FunWithFunctions,Part2
rankMe :: (Num a, Ord a) => a -> a -> a -> [Char]
rankMe added deleted modified
| lines > 100 = "Senior"
| lines > 30 = "Regular"
| lines >= 0 = "Junior"
| lines < 0 = "Congrats! You are a true Hacker!"
where lines = added - deleted
Creatingnewtypes
Creatingnewtypes-aliasing
Creatingnewtypes-aliasing
type String = [Char]
Creatingnewtypes-aliasing
type String = [Char]
type Point = (Int, Int)
Creatingnewtypes-aliasing
type String = [Char]
type Point = (Int, Int)
type Parser a = String -> (a, String)
Creatingnewtypes
Creatingnewtypes-Datadeclarations
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
bootup :: OS -> [Char]
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
bootup :: OS -> [Char]
bootup Unix = "Up and running"
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
bootup :: OS -> [Char]
bootup Unix = "Up and running"
bootup Linux = "Well, I was actually never down..."
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
bootup :: OS -> [Char]
bootup Unix = "Up and running"
bootup Linux = "Well, I was actually never down..."
bootup OSX = "Non-sufficient Starbucks coffee, please refill"
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
bootup :: OS -> [Char]
bootup Unix = "Up and running"
bootup Linux = "Well, I was actually never down..."
bootup OSX = "Non-sufficient Starbucks coffee, please refill"
bootup Windows = "Upgrading to Windows 10, this should take a
second.."
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
class Bootable a where
boot :: a -> [Char]
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
class Bootable a where
boot :: a -> [Char]
instance Bootable OS where
boot Unix = "Up and running"
boot Linux = "Well, I was actually never down..."
boot OSX = "Non-sufficient Starbucks coffee, please refill"
boot Windows = "Upgrading to Windows 10, this should take a
second.."
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
instance Eq OS where
Unix == Unix = True
Linux == Linux = True
OSX == OSX = True
Windows == Windows = True
_ == _ = False
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
instance Eq OS where
Unix == Unix = True
Linux == Linux = True
OSX == OSX = True
Windows == Windows = True
_ == _ = False
> Unix == Windows
False
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
instance Show OS where
show Unix = "Unix"
show Linux = "Linux"
show OSX = "OSX"
show Windows = "Windows"
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
instance Show OS where
show Unix = "Unix"
show Linux = "Linux"
show OSX = "OSX"
show Windows = "Windows"
> show Unix
"Unix"
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
deriving (Eq, Ord, Show, Read)
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
deriving (Eq, Ord, Show, Read)
> Windows == Unix
False
Creatingnewtypes-Datadeclarations
data OS = Windows | OSX | Linux | Unix
deriving (Eq, Ord, Show, Read)
> Windows == Unix
False
> show Windows
"Windows"
> read "Windows"::OS
Windows
> Linux > Windows
True
Creatingnewtypes-Datadeclarations
data Shape = Circle Float | Rect Float Float
deriving Show
> Circle 10
Circle 10.0
data Option a = Nothing | Some a
deriving Show
> Some “one”
Some “one”
Creatingnewtypes-Datadeclarations
data Shape = Circle Float | Rect Float Float
deriving Show
> Circle 10
Circle 10.0
data Option a = Nothing | Some a
deriving Show
> Some “one”
Some “one”
Expressiveness
Quicksort
Quicksort
qs [] = []
Quicksort
qs [] = []
qs (x : xs) = qs smaller ++ [x] ++ qs larger
Quicksort
qs [] = []
qs (x : xs) = qs smaller ++ [x] ++ qs larger
where smaller = [a | a <- xs, a <= x]
larger = [b | b <- xs, b > x]
Quicksort
qs [] = []
qs (x : xs) = qs smaller ++ [x] ++ qs larger
where smaller = [a | a <- xs, a <= x]
larger = [b | b <- xs, b > x]
> qs [3,7,1,9,3,10]
[1,3,3,7,9,10]
FizzBuzz
FizzBuzz
1,
FizzBuzz
1,2
FizzBuzz
1,2,Fizz,
FizzBuzz
1,2,Fizz,4,Buzz,
FizzBuzz
1,2,Fizz,4,Buzz,Fizz,7,8,Fizz,Buzz,11,12,13,
FizzBuzz
1,2,Fizz,4,Buzz,Fizz,7,8,Fizz,Buzz,11,12,13,14,FizzBuzz,..
FizzBuzz
FizzBuzz
fizzes = cycle ["", "", "fizz"]
buzzes = cycle ["", "", "", "", "buzz"]
FizzBuzz
fizzes = cycle ["", "", "fizz"]
buzzes = cycle ["", "", "", "", "buzz"]
pattern = zipWith (++) fizzes buzzes
FizzBuzz
fizzes = cycle ["", "", "fizz"]
buzzes = cycle ["", "", "", "", "buzz"]
pattern = zipWith (++) fizzes buzzes
> take 16 pattern
["","","fizz","","buzz","fizz","","","fizz","buzz","","
fizz","","","fizzbuzz",""]
FizzBuzz
fizzes = cycle ["", "", "fizz"]
buzzes = cycle ["", "", "", "", "buzz"]
pattern = zipWith (++) fizzes buzzes
FizzBuzz
fizzes = cycle ["", "", "fizz"]
buzzes = cycle ["", "", "", "", "buzz"]
pattern = zipWith (++) fizzes buzzes
fizzbuzz = zipWith combine pattern [1..]
where combine word number =
if null word then show number else word
FizzBuzz
fizzes = cycle ["", "", "fizz"]
buzzes = cycle ["", "", "", "", "buzz"]
pattern = zipWith (++) fizzes buzzes
fizzbuzz = zipWith combine pattern [1..]
where combine word number =
> take 16 pattern if null word then show number else word
["1","2","fizz","4","buzz","fizz","7","8","fizz","buzz","
11","fizz","13","14","fizzbuzz","16"]
Whatnext?
Whatnext?
Whatnext?
1. Read “Why Functional Programming Matters paper”
Whatnext?
1. Read “Why Functional Programming Matters paper”
2. Try to implement examples from that paper using Haskell
Whatnext?
1. Read “Why Functional Programming Matters paper”
2. Try to implement examples from that paper using Haskell
3. Sign for FP101x
Whatnext?
1. Read “Why Functional Programming Matters paper”
2. Try to implement examples from that paper using Haskell
3. Sign for FP101x
https://courses.edx.org/courses/course-v1:
DelftX+FP101x+3T2015/courseware/79633017711e44c9878df4f33701
4766/
Whatnext?
1. Read “Why Functional Programming Matters paper”
2. Try to implement examples from that paper using Haskell
3. Sign for FP101x
4. Try out Frege (Haskell on the JVM)
Whatnext?
1. Read “Why Functional Programming Matters paper”
2. Try to implement examples from that paper using Haskell
3. Sign for FP101x
4. Try out Frege (Haskell on the JVM)
https://github.com/Frege/frege
PawelSzulc
PawelSzulc
twitter: @rabbitonweb,
PawelSzulc
twitter: @rabbitonweb,
github: github.com/rabbitonweb
PawelSzulc
twitter: @rabbitonweb,
github: github.com/rabbitonweb
blog: rabbitonweb.com
PawelSzulc
THANKYOUVERYMUCH
twitter: @rabbitonweb,
github: github.com/rabbitonweb
blog: rabbitonweb.com

Más contenido relacionado

La actualidad más candente

Making an Object System with Tcl 8.5
Making an Object System with Tcl 8.5Making an Object System with Tcl 8.5
Making an Object System with Tcl 8.5Donal Fellows
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecLoïc Descotte
 
Optimizing Tcl Bytecode
Optimizing Tcl BytecodeOptimizing Tcl Bytecode
Optimizing Tcl BytecodeDonal Fellows
 
Matlab and Python: Basic Operations
Matlab and Python: Basic OperationsMatlab and Python: Basic Operations
Matlab and Python: Basic OperationsWai Nwe Tun
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimizationg3_nittala
 
python beginner talk slide
python beginner talk slidepython beginner talk slide
python beginner talk slidejonycse
 
Python Performance 101
Python Performance 101Python Performance 101
Python Performance 101Ankur Gupta
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance PythonIan Ozsvald
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meetMario Fusco
 
Python and sysadmin I
Python and sysadmin IPython and sysadmin I
Python and sysadmin IGuixing Bai
 
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...John De Goes
 
Introduction to Python and TensorFlow
Introduction to Python and TensorFlowIntroduction to Python and TensorFlow
Introduction to Python and TensorFlowBayu Aldi Yansyah
 
Learn python - for beginners - part-2
Learn python - for beginners - part-2Learn python - for beginners - part-2
Learn python - for beginners - part-2RajKumar Rampelli
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In PythonMarwan Osman
 
Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7Paulo Morgado
 
Tuga it 2016 - What's New In C# 6
Tuga it 2016 - What's New In C# 6Tuga it 2016 - What's New In C# 6
Tuga it 2016 - What's New In C# 6Paulo Morgado
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In JavaAndrei Solntsev
 
Metaprogramming in Haskell
Metaprogramming in HaskellMetaprogramming in Haskell
Metaprogramming in HaskellHiromi Ishii
 

La actualidad más candente (20)

Hammurabi
HammurabiHammurabi
Hammurabi
 
Making an Object System with Tcl 8.5
Making an Object System with Tcl 8.5Making an Object System with Tcl 8.5
Making an Object System with Tcl 8.5
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 
Optimizing Tcl Bytecode
Optimizing Tcl BytecodeOptimizing Tcl Bytecode
Optimizing Tcl Bytecode
 
Matlab and Python: Basic Operations
Matlab and Python: Basic OperationsMatlab and Python: Basic Operations
Matlab and Python: Basic Operations
 
Profiling and optimization
Profiling and optimizationProfiling and optimization
Profiling and optimization
 
python beginner talk slide
python beginner talk slidepython beginner talk slide
python beginner talk slide
 
Python Performance 101
Python Performance 101Python Performance 101
Python Performance 101
 
Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
 
Python and sysadmin I
Python and sysadmin IPython and sysadmin I
Python and sysadmin I
 
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming...
 
Introduction to Python and TensorFlow
Introduction to Python and TensorFlowIntroduction to Python and TensorFlow
Introduction to Python and TensorFlow
 
Learn python - for beginners - part-2
Learn python - for beginners - part-2Learn python - for beginners - part-2
Learn python - for beginners - part-2
 
Programming Under Linux In Python
Programming Under Linux In PythonProgramming Under Linux In Python
Programming Under Linux In Python
 
Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7Tuga IT 2017 - What's new in C# 7
Tuga IT 2017 - What's new in C# 7
 
Tuga it 2016 - What's New In C# 6
Tuga it 2016 - What's New In C# 6Tuga it 2016 - What's New In C# 6
Tuga it 2016 - What's New In C# 6
 
Functional Programming In Java
Functional Programming In JavaFunctional Programming In Java
Functional Programming In Java
 
Metaprogramming in Haskell
Metaprogramming in HaskellMetaprogramming in Haskell
Metaprogramming in Haskell
 
Functional programming in java
Functional programming in javaFunctional programming in java
Functional programming in java
 

Destacado

走马观花— Haskell Web 开发
走马观花— Haskell Web 开发走马观花— Haskell Web 开发
走马观花— Haskell Web 开发Gump Law
 
Introduction to type classes in 30 min
Introduction to type classes in 30 minIntroduction to type classes in 30 min
Introduction to type classes in 30 minPawel Szulc
 
Functional Programming by Examples using Haskell
Functional Programming by Examples using HaskellFunctional Programming by Examples using Haskell
Functional Programming by Examples using Haskellgoncharenko
 
Category theory is general abolute nonsens
Category theory is general abolute nonsensCategory theory is general abolute nonsens
Category theory is general abolute nonsensPawel Szulc
 
Introduction to type classes
Introduction to type classesIntroduction to type classes
Introduction to type classesPawel Szulc
 
The cats toolbox a quick tour of some basic typeclasses
The cats toolbox  a quick tour of some basic typeclassesThe cats toolbox  a quick tour of some basic typeclasses
The cats toolbox a quick tour of some basic typeclassesPawel Szulc
 
2016-11-12 02 Николай Линкер. Чему Java может поучиться у Haskell и наоборот
2016-11-12 02 Николай Линкер. Чему Java может поучиться у Haskell и наоборот2016-11-12 02 Николай Линкер. Чему Java может поучиться у Haskell и наоборот
2016-11-12 02 Николай Линкер. Чему Java может поучиться у Haskell и наоборотОмские ИТ-субботники
 
Haskell for the Real World
Haskell for the Real WorldHaskell for the Real World
Haskell for the Real WorldBryan O'Sullivan
 
Apache spark when things go wrong
Apache spark   when things go wrongApache spark   when things go wrong
Apache spark when things go wrongPawel Szulc
 
Writing your own RDD for fun and profit
Writing your own RDD for fun and profitWriting your own RDD for fun and profit
Writing your own RDD for fun and profitPawel Szulc
 
Apache spark workshop
Apache spark workshopApache spark workshop
Apache spark workshopPawel Szulc
 
“Going bananas with recursion schemes for fixed point data types”
“Going bananas with recursion schemes for fixed point data types”“Going bananas with recursion schemes for fixed point data types”
“Going bananas with recursion schemes for fixed point data types”Pawel Szulc
 
Going bananas with recursion schemes for fixed point data types
Going bananas with recursion schemes for fixed point data typesGoing bananas with recursion schemes for fixed point data types
Going bananas with recursion schemes for fixed point data typesPawel Szulc
 
Make your programs Free
Make your programs FreeMake your programs Free
Make your programs FreePawel Szulc
 

Destacado (15)

走马观花— Haskell Web 开发
走马观花— Haskell Web 开发走马观花— Haskell Web 开发
走马观花— Haskell Web 开发
 
Introduction to type classes in 30 min
Introduction to type classes in 30 minIntroduction to type classes in 30 min
Introduction to type classes in 30 min
 
Functional Programming by Examples using Haskell
Functional Programming by Examples using HaskellFunctional Programming by Examples using Haskell
Functional Programming by Examples using Haskell
 
Category theory is general abolute nonsens
Category theory is general abolute nonsensCategory theory is general abolute nonsens
Category theory is general abolute nonsens
 
Introduction to type classes
Introduction to type classesIntroduction to type classes
Introduction to type classes
 
Haskellでプレゼン
HaskellでプレゼンHaskellでプレゼン
Haskellでプレゼン
 
The cats toolbox a quick tour of some basic typeclasses
The cats toolbox  a quick tour of some basic typeclassesThe cats toolbox  a quick tour of some basic typeclasses
The cats toolbox a quick tour of some basic typeclasses
 
2016-11-12 02 Николай Линкер. Чему Java может поучиться у Haskell и наоборот
2016-11-12 02 Николай Линкер. Чему Java может поучиться у Haskell и наоборот2016-11-12 02 Николай Линкер. Чему Java может поучиться у Haskell и наоборот
2016-11-12 02 Николай Линкер. Чему Java может поучиться у Haskell и наоборот
 
Haskell for the Real World
Haskell for the Real WorldHaskell for the Real World
Haskell for the Real World
 
Apache spark when things go wrong
Apache spark   when things go wrongApache spark   when things go wrong
Apache spark when things go wrong
 
Writing your own RDD for fun and profit
Writing your own RDD for fun and profitWriting your own RDD for fun and profit
Writing your own RDD for fun and profit
 
Apache spark workshop
Apache spark workshopApache spark workshop
Apache spark workshop
 
“Going bananas with recursion schemes for fixed point data types”
“Going bananas with recursion schemes for fixed point data types”“Going bananas with recursion schemes for fixed point data types”
“Going bananas with recursion schemes for fixed point data types”
 
Going bananas with recursion schemes for fixed point data types
Going bananas with recursion schemes for fixed point data typesGoing bananas with recursion schemes for fixed point data types
Going bananas with recursion schemes for fixed point data types
 
Make your programs Free
Make your programs FreeMake your programs Free
Make your programs Free
 

Similar a Fun never stops. introduction to haskell programming language

An introduction to Raku
An introduction to RakuAn introduction to Raku
An introduction to RakuSimon Proctor
 
Haskell - Being lazy with class
Haskell - Being lazy with classHaskell - Being lazy with class
Haskell - Being lazy with classTiago Babo
 
Functional Pearls 4 (YAPC::EU::2009 remix)
Functional Pearls 4 (YAPC::EU::2009 remix)Functional Pearls 4 (YAPC::EU::2009 remix)
Functional Pearls 4 (YAPC::EU::2009 remix)osfameron
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?osfameron
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospectivechenge2k
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaLin Yo-An
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()daewon jeong
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchinaguestcf9240
 
SimpleR: tips, tricks & tools
SimpleR: tips, tricks & toolsSimpleR: tips, tricks & tools
SimpleR: tips, tricks & toolsRob Hyndman
 
Programming in Vinyl (BayHac 2014)
Programming in Vinyl (BayHac 2014)Programming in Vinyl (BayHac 2014)
Programming in Vinyl (BayHac 2014)jonsterling
 
Perl 5.10
Perl 5.10Perl 5.10
Perl 5.10acme
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perlworr1244
 
Whatsnew in-perl
Whatsnew in-perlWhatsnew in-perl
Whatsnew in-perldaoswald
 
What's new in Perl 5.10?
What's new in Perl 5.10?What's new in Perl 5.10?
What's new in Perl 5.10?acme
 
FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳Yuri Inoue
 
The Little Register Allocator
The Little Register AllocatorThe Little Register Allocator
The Little Register AllocatorIan Wang
 
Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.VimLin Yo-An
 

Similar a Fun never stops. introduction to haskell programming language (20)

An introduction to Raku
An introduction to RakuAn introduction to Raku
An introduction to Raku
 
Haskell - Being lazy with class
Haskell - Being lazy with classHaskell - Being lazy with class
Haskell - Being lazy with class
 
Functional Pearls 4 (YAPC::EU::2009 remix)
Functional Pearls 4 (YAPC::EU::2009 remix)Functional Pearls 4 (YAPC::EU::2009 remix)
Functional Pearls 4 (YAPC::EU::2009 remix)
 
Functional Programming in JAVA 8
Functional Programming in JAVA 8Functional Programming in JAVA 8
Functional Programming in JAVA 8
 
Easy R
Easy REasy R
Easy R
 
Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?Is Haskell an acceptable Perl?
Is Haskell an acceptable Perl?
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospective
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchina
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
 
Perl Presentation
Perl PresentationPerl Presentation
Perl Presentation
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchina
 
SimpleR: tips, tricks & tools
SimpleR: tips, tricks & toolsSimpleR: tips, tricks & tools
SimpleR: tips, tricks & tools
 
Programming in Vinyl (BayHac 2014)
Programming in Vinyl (BayHac 2014)Programming in Vinyl (BayHac 2014)
Programming in Vinyl (BayHac 2014)
 
Perl 5.10
Perl 5.10Perl 5.10
Perl 5.10
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
 
Whatsnew in-perl
Whatsnew in-perlWhatsnew in-perl
Whatsnew in-perl
 
What's new in Perl 5.10?
What's new in Perl 5.10?What's new in Perl 5.10?
What's new in Perl 5.10?
 
FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳FP in scalaで鍛える関数型脳
FP in scalaで鍛える関数型脳
 
The Little Register Allocator
The Little Register AllocatorThe Little Register Allocator
The Little Register Allocator
 
Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.Vim
 

Más de Pawel Szulc

Getting acquainted with Lens
Getting acquainted with LensGetting acquainted with Lens
Getting acquainted with LensPawel Szulc
 
Maintainable Software Architecture in Haskell (with Polysemy)
Maintainable Software Architecture in Haskell (with Polysemy)Maintainable Software Architecture in Haskell (with Polysemy)
Maintainable Software Architecture in Haskell (with Polysemy)Pawel Szulc
 
Painless Haskell
Painless HaskellPainless Haskell
Painless HaskellPawel Szulc
 
Trip with monads
Trip with monadsTrip with monads
Trip with monadsPawel Szulc
 
Trip with monads
Trip with monadsTrip with monads
Trip with monadsPawel Szulc
 
Illogical engineers
Illogical engineersIllogical engineers
Illogical engineersPawel Szulc
 
RChain - Understanding Distributed Calculi
RChain - Understanding Distributed CalculiRChain - Understanding Distributed Calculi
RChain - Understanding Distributed CalculiPawel Szulc
 
Illogical engineers
Illogical engineersIllogical engineers
Illogical engineersPawel Szulc
 
Understanding distributed calculi in Haskell
Understanding distributed calculi in HaskellUnderstanding distributed calculi in Haskell
Understanding distributed calculi in HaskellPawel Szulc
 
Software engineering the genesis
Software engineering  the genesisSoftware engineering  the genesis
Software engineering the genesisPawel Szulc
 
Real world gobbledygook
Real world gobbledygookReal world gobbledygook
Real world gobbledygookPawel Szulc
 
Know your platform. 7 things every scala developer should know about jvm
Know your platform. 7 things every scala developer should know about jvmKnow your platform. 7 things every scala developer should know about jvm
Know your platform. 7 things every scala developer should know about jvmPawel Szulc
 
Monads asking the right question
Monads  asking the right questionMonads  asking the right question
Monads asking the right questionPawel Szulc
 
Apache Spark 101 [in 50 min]
Apache Spark 101 [in 50 min]Apache Spark 101 [in 50 min]
Apache Spark 101 [in 50 min]Pawel Szulc
 
Javascript development done right
Javascript development done rightJavascript development done right
Javascript development done rightPawel Szulc
 
Architektura to nie bzdura
Architektura to nie bzduraArchitektura to nie bzdura
Architektura to nie bzduraPawel Szulc
 
Testing and Testable Code
Testing and Testable CodeTesting and Testable Code
Testing and Testable CodePawel Szulc
 

Más de Pawel Szulc (18)

Getting acquainted with Lens
Getting acquainted with LensGetting acquainted with Lens
Getting acquainted with Lens
 
Impossibility
ImpossibilityImpossibility
Impossibility
 
Maintainable Software Architecture in Haskell (with Polysemy)
Maintainable Software Architecture in Haskell (with Polysemy)Maintainable Software Architecture in Haskell (with Polysemy)
Maintainable Software Architecture in Haskell (with Polysemy)
 
Painless Haskell
Painless HaskellPainless Haskell
Painless Haskell
 
Trip with monads
Trip with monadsTrip with monads
Trip with monads
 
Trip with monads
Trip with monadsTrip with monads
Trip with monads
 
Illogical engineers
Illogical engineersIllogical engineers
Illogical engineers
 
RChain - Understanding Distributed Calculi
RChain - Understanding Distributed CalculiRChain - Understanding Distributed Calculi
RChain - Understanding Distributed Calculi
 
Illogical engineers
Illogical engineersIllogical engineers
Illogical engineers
 
Understanding distributed calculi in Haskell
Understanding distributed calculi in HaskellUnderstanding distributed calculi in Haskell
Understanding distributed calculi in Haskell
 
Software engineering the genesis
Software engineering  the genesisSoftware engineering  the genesis
Software engineering the genesis
 
Real world gobbledygook
Real world gobbledygookReal world gobbledygook
Real world gobbledygook
 
Know your platform. 7 things every scala developer should know about jvm
Know your platform. 7 things every scala developer should know about jvmKnow your platform. 7 things every scala developer should know about jvm
Know your platform. 7 things every scala developer should know about jvm
 
Monads asking the right question
Monads  asking the right questionMonads  asking the right question
Monads asking the right question
 
Apache Spark 101 [in 50 min]
Apache Spark 101 [in 50 min]Apache Spark 101 [in 50 min]
Apache Spark 101 [in 50 min]
 
Javascript development done right
Javascript development done rightJavascript development done right
Javascript development done right
 
Architektura to nie bzdura
Architektura to nie bzduraArchitektura to nie bzdura
Architektura to nie bzdura
 
Testing and Testable Code
Testing and Testable CodeTesting and Testable Code
Testing and Testable Code
 

Último

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 

Último (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 

Fun never stops. introduction to haskell programming language