Skip to content

Commit

Permalink
Update slides
Browse files Browse the repository at this point in the history
  • Loading branch information
egnwd committed Oct 12, 2020
1 parent e821756 commit cf8d03e
Show file tree
Hide file tree
Showing 24 changed files with 441 additions and 271 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ cabal.project.local~
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf

## Generated if empty string is given at "Please type another file name for output:"
.pdf
*.pdf

## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
Expand Down
Binary file added presentation/d7seg.657pk
Binary file not shown.
15 changes: 12 additions & 3 deletions presentation/defs.tex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
\newcommand\join{\mathsf{join}}
\newcommand\oo{\ensuremath{\,\circ\,}}
\newcommand\om{\ensuremath{\,\odot\,}}
\newcommand{\M}[1]{\ensuremath{\mathsf{M}\,#1}}
\newcommand{\F}[1]{\ensuremath{\mathsf{F}\,#1}}
\newcommand{\A}[1]{\ensuremath{\mathsf{A}\,#1}}
\newcommand{\M}[1]{\ensuremath{\mathsf{m}\,#1}}
\newcommand{\F}[1]{\ensuremath{\mathsf{f}\,#1}}
\newcommand{\A}[1]{\ensuremath{\mathsf{f}\,#1}}
\newcommand{\fn}[1]{\ensuremath{\mathsf{#1}}}
\newcommand{\Reader}[1]{\ensuremath{\mathbf{Reader}\,c\,#1}}
\newcommand{\ReaderH}[1]{\ensuremath{\mylib{$\mathbf{Reader}\,c$}\,\mylibo{#1}}}
\newcommand{\State}[1]{\ensuremath{\mathbf{State}\,s\,#1}}
\newcommand{\StateH}[1]{\ensuremath{\mylib{$\mathbf{State}\,s$}\,\mylibo{#1}}}
\newcommand{\Writer}[1]{\ensuremath{\mathbf{Writer}\,[\ell]\,#1}}
\newcommand{\WriterM}[1]{\ensuremath{\mathbf{Writer}\,\ell\,#1}}
\newcommand{\WriterH}[1]{\ensuremath{\mylib{$\mathbf{Writer}\,[\ell]$}\,\mylibo{#1}}}
\newcommand\mappend{\ensuremath{\mathbin{+\mkern-8mu+}}}
18 changes: 17 additions & 1 deletion presentation/final.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
\section{It's Trevor Hunting Time}
\begin{frame}
\begin{frame}[fragile]
\fontsize{30pt}{1em}\selectfont
\vspace*{-260pt}
\hspace*{-225pt}
\begin{tikzpicture}[scale=1.3, every shadow/.style={opacity=1,fill=blue!10!black}]
\foreach \l in {300.8,280.8,...,60.8} {%
\path[circular glow={shadow scale=1.03}, shading=radial, inner color=yellow!80!white, outer color=red!50!black] (0, 0) circle (\l pt);
}

\begin{scope}
\path[circular glow={shadow scale=1.03}, shading=radial, inner color=blue!25!black, outer color=darkblueOuter,clip] (0, 0) circle (60pt)
node[circle,inner sep=60pt,fill overzoom image=wumpus] at (0pt, -35pt) {};
\end{scope}

\node (b) at (-3, -0.8) {};
\node (e) at (10, -1.2) {};
\draw[decoration={text along path, text color=white, text={That's all Folks!}}, decorate] (b) to[bend left=15] (e);
\end{tikzpicture}
\end{frame}
Binary file added presentation/images/monad-meme.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added presentation/images/wumpus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified presentation/index.pdf
Binary file not shown.
142 changes: 117 additions & 25 deletions presentation/index.tex
Original file line number Diff line number Diff line change
@@ -1,14 +1,83 @@
\documentclass{beamer}
\PassOptionsToPackage{usenames,dvipsnames}{xcolor}
\usepackage{xcolor}
\usetheme{Boadilla}
\usepackage[cache=false]{minted}
\usepackage{multicol}
\usepackage{latexsym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[T1]{fontenc} %
\usepackage[skins,most]{tcolorbox}
\usepackage{mathtools}
\usepackage{tikz}
\usepackage{addfont}
\addfont{OT1}{d7seg}{\dviiseg}
\usepackage{fontspec}
\usepackage{changepage}
\let\origcheckmark\checkmark % save the macro
\let\checkmark\relax % reset it, so it can be defined using `\newcommand` can be used without error
\usepackage{dingbat} % load package
\let\altcheckmark\checkmark % save that macro definition under a different name if required
\let\checkmark\origcheckmark
\usetikzlibrary{decorations.text, shadows}
% \newfontfamily\looney[]{Folks}

\definecolor{darkblueOuter}{RGB}{1,11,23}
\definecolor{darkblueInner}{RGB}{1,18,37}

\graphicspath{{./images/}}
\input{defs}
% \tcbset{every box/.style={highlight math style={boxrule=0pt,arc=3pt, left=0pt,right=0pt,top=0pt,bottom=0pt,boxsep=2pt}} }

\definecolor{BlueGreen}{rgb}{0.0, 0.87, 0.87}
\definecolor{Amber}{rgb}{1.0, 0.49, 0.0}
\newtcbox{\mylib}{enhanced,nobeforeafter,tcbox raise base,boxrule=0.4pt,top=0.5pt,bottom=0.5pt,
right=0mm,left=0mm,arc=1pt,boxsep=1pt,before upper={\vphantom{dlg}},
colframe=BlueGreen!50!white,coltext=BlueGreen!25!black,colback=BlueGreen!50,
overlay={\begin{tcbclipinterior}(frame.north west);\end{tcbclipinterior}}}

\robustify{\mylib}

\pdfstringdefDisableCommands{%
\def\mylib#1{'#1'}%
}

\newtcbox{\mylibo}{enhanced,nobeforeafter,tcbox raise base,boxrule=0.4pt,top=0.5pt,bottom=0.5pt,
right=0mm,left=0mm,arc=1pt,boxsep=1pt,before upper={\vphantom{dlg}},
colframe=Amber!50!white,coltext=Amber!25!black,colback=Amber!50,
overlay={\begin{tcbclipinterior}(frame.north west);\end{tcbclipinterior}}}

\robustify{\mylibo}

\pdfstringdefDisableCommands{%
\def\mylibo#1{'#1'}%
}

\immediate\write18{sh ./scripts/reader.sh > reader-motivation.hs}
\immediate\write18{sh ./scripts/reader-types.sh > reader-types.hs}
\immediate\write18{sh ./scripts/state.sh > state-motivation.hs}
\immediate\write18{sh ./scripts/state-types.sh > state-types.hs}
\immediate\write18{sh ./scripts/writer.sh > writer-motivation.hs}
\immediate\write18{sh ./scripts/writer-types.sh > writer-types.hs}

\setminted[csharp]{baselinestretch=.8,fontsize=\tiny,autogobble}
\makeatletter
\newenvironment{code}
{\RecustomVerbatimEnvironment{Verbatim}{BVerbatim}{}%
\def\FV@BProcessLine##1{%
\hbox{%
\hbox to\z@{\hss\theFancyVerbLine\kern\FV@NumberSep}%
\FancyVerbFormatLine{##1}%
}%
}%
\VerbatimEnvironment
\setbox\z@=\hbox\bgroup
\begin{minted}{csharp}}
{\end{minted}\egroup
\leavevmode\vbox{\box\z@}}
\makeatother

\begin{document}
\titlegraphic{\vspace{-3em}\includegraphics[width=.3\textwidth]{hunted-wumpus.jpg}}
Expand All @@ -20,58 +89,81 @@
\end{frame}
\begin{frame}{Agenda}
\begin{columns}[t]
\begin{column}{.4\textwidth}
\tableofcontents[sections={1-2}]
\begin{column}{.5\textwidth}
\tableofcontents[sections={1-3}]
\end{column}
\begin{column}{.4\textwidth}
\tableofcontents[sections={3-5}]
\tableofcontents[sections={4-6}]
\end{column}
\end{columns}
\end{frame}
\section{What is Hunt the Wumpus?}
\begin{frame}{What is Hunt the Wumpus?}{Why are we Hunting Poor Trevor?}
You, the brave adventurer, have gotten lost and stumbled into a dark cavern.
You can barely see your hand in front of your face.
You heard rumours that Trevor, the Wumpus, lived in these here parts.\\[1em]
Ahead of you are:
\begin{itemize}[<+-| alert@+>]
\item 20 Caves, each connected to 3 other caves
\item 5 Arrows (a.k.a. 5 attempts to kill Trevor)
\item 2 crazy bats (that like to transport you to other caves)
\item 2 endless pits (that almost certainly mean death)
\item Some great fun from \dviiseg{1973}
\end{itemize}
\pause{On your turn you can Move to an adjoining cave, via a dark tunnel,
or shoot one of your crooked arrows in the hope of hitting the Wumpus.}\\
\pause{Fortunately, the bats make a lot of noise,
the pits cause an awful draft, \& Trevor is quite smelly!}
\end{frame}
\section{What is a Monad?}
\subsection{Intuition}
\begin{frame}[fragile]{What is a Monad? (Recap)}{Intuition}
Let's make a program

\begin{minted}{haskell}
main = do putStrLn "What is 2 + 2?"
x <- readLn
if x == 4
then putStrLn "You're right!"
else putStrLn "You're wrong!"
\end{minted}
\begin{frame}[fragile]{What is a Monad?}{Intuition}
\begin{columns}
\begin{column}{.4\textwidth}
\includegraphics[width=\textwidth]{monad-meme}
\end{column}
\begin{column}{.4\textwidth}
\begin{itemize}
\item A monad abstracts computation away
\item It is defined by two functions:
\begin{itemize}
\item one to take non-monadic value and \textit{return} a monadic one
\item another to take monadic value and \textit{bind} the underlying value to a function
\end{itemize}
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\subsection{Theory}
\begin{frame}{What is a Monad? (Recap)}{Theory}
\begin{frame}{What is a Monad?}{Theory}
\begin{block}{Functor Definition}
\begin{align*}
\fmap &:: \mathbf{Functor}\ \mathsf{F}\ \Rightarrow\ (a\ \rightarrow\ b)\ \rightarrow\ \F{a}\ \rightarrow\ \F{b}\\
\fmap &:: \mathbf{Functor}\ \mathsf{f}\ \Rightarrow\ (a\ \rightarrow\ b)\ \rightarrow\ \F{a}\ \rightarrow\ \F{b}\\
\end{align*}
\end{block}
\begin{block}{Applicative Definition}
\begin{align*}
\pure &:: \mathbf{Applicative}\ \mathsf{A}\ \Rightarrow\ a\ \rightarrow\ \A{a}\\
(\app) &:: \mathbf{Applicative}\ \mathsf{A}\ \Rightarrow\ \A{(a\ \rightarrow\ b)}\ \rightarrow\ \A{a}\ \rightarrow\ \A{b}\\
\pure &:: \mathbf{Applicative}\ \mathsf{f}\ \Rightarrow\ a\ \rightarrow\ \A{a}\\
(\app) &:: \mathbf{Applicative}\ \mathsf{f}\ \Rightarrow\ \A{(a\ \rightarrow\ b)}\ \rightarrow\ \A{a}\ \rightarrow\ \A{b}\\
\end{align*}
\end{block}
\end{frame}
\begin{frame}{What is a Monad? (Recap)}{Theory}
\begin{frame}{What is a Monad?}{Theory}
\begin{block}{Monad Definition}
\begin{align*}
\return &:: \mathbf{Monad}\ \mathsf{M}\ \Rightarrow\ a\ \rightarrow\ \M{a}\\
(\bind) &:: \mathbf{Monad}\ \mathsf{M}\ \Rightarrow\ \M{a}\ \rightarrow\ (a\ \rightarrow\ \M{b})\ \rightarrow\ \M{b}\\
\return &:: \mathbf{Monad}\ \mathsf{m}\ \Rightarrow\ a\ \rightarrow\ \M{a}\\
(\bind) &:: \mathbf{Monad}\ \mathsf{m}\ \Rightarrow\ \M{a}\ \rightarrow\ (a\ \rightarrow\ \M{b})\ \rightarrow\ \M{b}\\
\end{align*}
\end{block}
\begin{itemize}
\item $\return$ constructs the monad\\
\item $\return$ constructs the monad from a value\\
\item $\bind$ allows composition of the monad\\
\item Note: You might see other people say you need $\join$ to define the monad,
providing either $\bind$ or $\join$ is ``rigorously'' equivalent.
\item \textit{Note: You might see other people say you need $\join$ to define the monad,
providing either $\bind$ or $\join$ is ``rigorously'' equivalent.}
\end{itemize}
\end{frame}

\input{reader}%
\input{writer}%
\input{state}%
\input{writer}%
\input{final}%
\end{document}
Loading

0 comments on commit cf8d03e

Please sign in to comment.