/
applicative.tex
33 lines (32 loc) · 965 Bytes
/
applicative.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
\begin{frame}[fragile]
\frametitle{Applicative Functor}
\framesubtitle{The interface}
\begin{block}{Java 8/C\# with the addition of higher-kinded polymorphism}
\begin{lstlisting}[style=language,language=java]
interface Applicative<T> {
<A, B> T<B> apply(T<Function<A, B>> f, T<A> a);
<X> T<X> unit(X x);
}
\end{lstlisting}
\end{block}
\begin{block}{Haskell}
\begin{lstlisting}[style=language,language=haskell]
class Applicative t where
apply :: t (a -> b) -> t a -> t b
unit :: x -> t x
\end{lstlisting}
\end{block}
\end{frame}
\begin{frame}[fragile]
\frametitle{Applicative Functor}
\begin{block}{Well blimey mate. Guess what?}
\begin{itemize}
\item It's just another interface, with laws, instances and operations.
\item An applicative functor is
\begin{itemize}
\item strictly stronger than functor. All applicatives are functors.
\item strictly weaker than monad. All monads are applicative.
\end{itemize}
\end{itemize}
\end{block}
\end{frame}