SlideShare a Scribd company logo
Liftin’ Every Day
Applicative Functors?
pure :: a -> f a
ap :: f (a -> b) -> f a -> f b
Liftin every day
Closed Under
Composition
Closed Under
Composition
Closed Under
Composition
Closed Under
Composition
liftA :: (a -> b) -> f a -> f b
liftA2 :: (a -> b -> c) -> f a -> f b -> f c
liftA :: (a -> b) -> f a -> f b
liftA2 :: (a -> b -> c) -> f a -> f b -> f c
Just fmap
liftA :: (a -> b) -> f a -> f b
liftA2 :: (a -> b -> c) -> f a -> f b -> f c
Just fmap
We can get arity
automatically
ap(pure(f), x, y) == liftA(f, x, y)
Ultimate Combinator
f(g(x), h(x),..n(x))
Liftin every day
f(g(x), h(x))
Liftin every day
f(g(x), h(x))
Liftin every day
Liftin every day
Liftin every day
List Comprehensions
Liftin every day
Liftin every day
Liftin every day
Liftin every day
A Quick Word about
Comma Overloading
Liftin every day
ZipLists
ap([f, g], [x,y])
[f(x), f(y), g(x), g(y)]
-or-
ap([f, g], [x,y])
[f(x), g(y)]
ap([f, g], [x,y])
[f(x), f(y), g(x), g(y)]
-or-
ap([f, g], [x,y])
[f(x), g(y)]
ZipList
Liftin every day
Liftin every day
Liftin every day
Eventual Results
Liftin every day
Liftin every day
Liftin every day
Liftin every day
Combinators
Comprehensions
Semaphores
Parallel Computations
Composition
Lots more I didn’t get to...
• http://looprecur.com
• @drboolean
• drboolean.tumblr.com
• https://github.com/loop-recur/typeclasses
THANKS!

More Related Content

Liftin every day