Skip to content

Commit

Permalink
fix Lecture 5 and Lecture 6
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRrr committed Aug 26, 2021
1 parent 463d157 commit 1ecb943
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 24 deletions.
Binary file modified Lecture1/Slides.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion Lecture1/Slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
% The Document
% ------------------------------------------------------------------------------
\title{Functional programming, Seminar No. 1}
\author{Danya Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\author{Daniel Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}

\vspace{\baselineskip}

Expand Down
Binary file modified Lecture2/Slides.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion Lecture2/Slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
}

\title{Functional programming, Seminar No. 2}
\author{Danya Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\author{Daniel Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\date{Higher School of Economics \\ The Faculty of Computer Science}
\begin{document}

Expand Down
Binary file modified Lecture3/Slides.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion Lecture3/Slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
}

\title{Functional programming, Seminar No. 3}
\author{Danya Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\author{Daniel Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\date{Higher School of Economics \\ The Faculty of Computer Science}
\begin{document}

Expand Down
Binary file modified Lecture4/Slides.pdf
Binary file not shown.
12 changes: 6 additions & 6 deletions Lecture4/Slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
}

\title{Functional programming, Seminar No. 4}
\author{Danya Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\author{Daniel Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\date{Higher School of Economics \\ The Faculty of Computer Science}
\begin{document}

Expand Down Expand Up @@ -126,7 +126,7 @@ \section{Algebraic data types and pattern matching}

\onslide<2->{
\begin{itemize}
\item Terms like \verb"(a,b)", \verb"[]", and \verb"(x : xs)" are called \emph{patterns}
\item Such expressions as \verb"(a,b)", \verb"[]", and \verb"(x : xs)" are called \emph{patterns}
\item One needs to check whether the constructors \verb"(,)" and \verb"( : )" are relevant.
\item Consider \verb"swap (45, True)". Variables \verb"a" and \verb"b" are bound with the values \verb"45" and \verb"True".
\item Consider \verb"lenght [1,2,3]". Variables \verb"x" and \verb"xs" are bound with the values \verb"1" and \verb"[2,3]"
Expand Down Expand Up @@ -297,7 +297,7 @@ \section{Algebraic data types and pattern matching}
\begin{frame}[fragile]
\frametitle{As-patterns}
\begin{itemize}
\item Suppose we have the following function
\item Suppose we have the following function (a quite bad one)
\begin{minted}{haskell}
dupHead :: [a] -> [a]
dupHead (x : xs) = x : x : xs
Expand Down Expand Up @@ -352,7 +352,7 @@ \section{Algebraic data types and pattern matching}
\begin{frame}[fragile]
\frametitle{Field labels}
\begin{itemize}
\item Sometimes product data types are too cumbersome:
\item Sometimes product data types are rather cumbersome:
\begin{minted}{haskell}
data Person = Person String String Int Float String
\end{minted}
Expand Down Expand Up @@ -398,7 +398,7 @@ \section{Algebraic data types and pattern matching}
\frametitle{Field labels and type classes}

\begin{itemize}
\item The previous listing a bit unsugared (very roughly):
\item The previous listing, an unsugared version (but very roughly):
\begin{minted}{haskell}
data Eq a =
Eq { eq :: a -> a -> Bool
Expand All @@ -420,7 +420,7 @@ \section{Algebraic data types and pattern matching}
\begin{frame}[fragile]
\frametitle{Some standard algebraic data types}
\begin{itemize}
\item The \verb"Maybe a" data type allows one to define an optional value:
\item The \verb"Maybe a" data type is a type of optional values:
\begin{minted}{haskell}
data Maybe a = Nothing | Just a
Expand Down
Binary file modified Lecture5/Slides.pdf
Binary file not shown.
10 changes: 5 additions & 5 deletions Lecture5/Slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
% The Document
% ------------------------------------------------------------------------------
\title{Functional programming, Seminar No. 5}
\author{Danya Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\author{Daniel Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\date{Higher School of Economics \\ The Faculty of Computer Science}

\begin{document}
Expand Down Expand Up @@ -434,7 +434,7 @@ \section{Functor}
\begin{frame}[fragile]
\frametitle{The \verb"Functor" laws}
Any \verb"Functor" instance is expected to satisfy the following axioms:
Any \verb"Functor" instance has to satisfy the following axioms:
\begin{minted}{haskell}
Expand All @@ -446,7 +446,7 @@ \section{Functor}
\begin{frame}[fragile]
\frametitle{The \verb"Functor" laws. Example}
Let us check that the list data type is really a functor.
Let us check that the list data type is really a functor by induction.
\begin{minted}{haskell}
Expand All @@ -464,7 +464,7 @@ \section{Functor}
\end{minted}
\end{frame}
\section{Applicative functors}
\section{Applicative Functors}
\begin{frame}[fragile]
\frametitle{Motivation}
Expand Down Expand Up @@ -563,7 +563,7 @@ \section{Applicative functors}
\end{minted}
How to implement \verb"pure" and preverse the applicative laws?
If we define \verb"pure" as below, that would break all those axioms.
If we define \verb"pure" as below, that would break all axioms of an applicative functor.
\begin{minted}{haskell}
pure x = ZipList [x]
\end{minted}
Expand Down
Binary file modified Lecture6/Slides.pdf
Binary file not shown.
12 changes: 5 additions & 7 deletions Lecture6/Slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
% The Document
% ------------------------------------------------------------------------------
\title{Functional programming, Seminar No. 6}
\author{Danya Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\author{Daniel Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}

\vspace{\baselineskip}

Expand Down Expand Up @@ -131,7 +131,6 @@ \section{Monads}
\item A computation with reading from an external environment \verb"a -> (e -> b)"
\item A computation with a mutable state: \verb"a -> (State s) b"
\item An input/output computation: \verb"a -> IO b"
\item A generalised version of such a function is a Kleisli function \verb"a -> m b"
\end{itemize}
\end{frame}

Expand All @@ -147,7 +146,7 @@ \section{Monads}
\begin{minted}{haskell}
(>=>) :: (a -> m b) -> (b -> m c) -> a -> m c
\end{minted}
\item In general, we \alert{cannot} extract \verb"a" from \verb"m a"
\item Generally, we \alert{cannot} extract \verb"a" from \verb"m a"
\end{enumerate}
\end{frame}

Expand Down Expand Up @@ -181,10 +180,9 @@ \section{Monads}
class Applicative m => Monad m where
join :: m (m a) -> m a
\end{minted}

\onslide<2->{
Moreover, such a definition is closer to the original categorical definition
of a monad.
of a monad. But we do not care about categories here.
}
\end{frame}

Expand Down Expand Up @@ -216,7 +214,7 @@ \section{Monads}
\begin{frame}[fragile]
\frametitle{The monadic bind operator}

Take a look at the monadic type signature closely:
Take a look at the monadic type signature closer:
\begin{minted}{haskell}
(>>=) :: Monad m => m a -> (a -> m b) -> m b
\end{minted}
Expand Down Expand Up @@ -252,7 +250,7 @@ \section{Monads}
\end{frame}

\begin{frame}[fragile]
\frametitle{The very first monad. The \verb"Identity" type}
\frametitle{The very first (trivial) monad. The \verb"Identity" type}

Let us define the following new type
\begin{minted}{haskell}
Expand Down
Binary file modified Lecture7/Slides.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion Lecture7/Slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
% The Document
% ------------------------------------------------------------------------------
\title{Functional programming, Seminar No. 7}
\author{Danya Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}
\author{Daniel Rogozin \\ Institute for Information Transmission Problems, RAS \\ Serokell O\"{U}}

\vspace{\baselineskip}

Expand Down
Binary file modified Lecture8/Slides.pdf
Binary file not shown.
7 changes: 5 additions & 2 deletions Lecture8/Slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
% The Document
% ------------------------------------------------------------------------------
\title{Functional programming, Seminar No. 8}
\author{Danya Rogozin \\ Lomonosov Moscow State University, \\ Serokell O\"{U}}
\author{Daniel Rogozin \\ Lomonosov Moscow State University, \\ Serokell O\"{U}}

\vspace{\baselineskip}

Expand Down Expand Up @@ -363,7 +363,10 @@ \section{Monad transformers}
writeFileWithLog path (format content)

main :: IO ()
main = runReaderT (prettifyFileContent "foo.txt") (LoggerName "Application")
main =
runReaderT
(prettifyFileContent "foo.txt")
(LoggerName "Application")
\end{minted}
\end{frame}

Expand Down

0 comments on commit 1ecb943

Please sign in to comment.