about summary refs log tree commit diff
path: root/presentations/servant-2016
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-06-26T19·38+0100
committertazjin <mail@tazj.in>2020-06-26T19·51+0000
commit2e3b03b5ae04cc9d4da0001aff07962bf4107d42 (patch)
tree75d929acb15720bc8eb1182d105e2ecaa2626ba0 /presentations/servant-2016
parent1d0e421cb86861c64b58d5aa66dce295ffe28af5 (diff)
chore(tazjin): Move my presentations to my user directory r/1090
Change-Id: I72b25680e7167c3a55477111c28b1d4936c60e2c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/606
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'presentations/servant-2016')
-rw-r--r--presentations/servant-2016/Makefile8
-rw-r--r--presentations/servant-2016/README.md7
-rw-r--r--presentations/servant-2016/slides.pdfbin71174 -> 0 bytes
-rw-r--r--presentations/servant-2016/slides.pdfpc75
-rw-r--r--presentations/servant-2016/slides.tex137
5 files changed, 0 insertions, 227 deletions
diff --git a/presentations/servant-2016/Makefile b/presentations/servant-2016/Makefile
deleted file mode 100644
index 96115ec2cbfc..000000000000
--- a/presentations/servant-2016/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-all: slides
-
-slides:
-	lualatex --shell-escape slides.tex
-
-clean:
-	rm -f slides.aux slides.log slides.nav \
-	slides.out slides.toc slides.snm
diff --git a/presentations/servant-2016/README.md b/presentations/servant-2016/README.md
deleted file mode 100644
index 8cfb04a42417..000000000000
--- a/presentations/servant-2016/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-These are the slides for my presentation about [servant][] at [Oslo Haskell][].
-
-A full video recording of the presentation is available [on Vimeo][].
-
-[servant]: https://haskell-servant.github.io/
-[Oslo Haskell]: http://www.meetup.com/Oslo-Haskell/events/227107530/
-[on Vimeo]: https://vimeo.com/153901805
diff --git a/presentations/servant-2016/slides.pdf b/presentations/servant-2016/slides.pdf
deleted file mode 100644
index 842a667e1bcc..000000000000
--- a/presentations/servant-2016/slides.pdf
+++ /dev/null
Binary files differdiff --git a/presentations/servant-2016/slides.pdfpc b/presentations/servant-2016/slides.pdfpc
deleted file mode 100644
index ed46003768c0..000000000000
--- a/presentations/servant-2016/slides.pdfpc
+++ /dev/null
@@ -1,75 +0,0 @@
-[file]
-slides.pdf
-[font_size]
-10897
-[notes]
-### 1
-13### 2
-Let's talk about servant, which is several things:
-API description DSL, we'll speak about how this DSL works
-and why it's at the type level
-
-Interpretations of the types resulting from that DSL, for example in
-web servers or API clients
-
-Servant is commonly used or implementing services with APIs, or for accessing
-other APIs with a simple, typed client
-### 3
-Why type-level DSLs?
-Type-level DSL:  express *something*, e.g. endpoints of API, on  type level by combining types. Types can be uninhabited
-
-Phil Wadler's: expression problem: things should be extensible both in the cases of a type, and in the functions operating on the type
-Normal data types: can't add new constructors easily
-Servant lifts thisup to simply allow the declaration of new types that can be included in the DSL, and new interpretations that can be attached to the types through typeclasses
-
-APIs become first-class citizens, can pass them around, combine them etc, they are separate from interpretations such as server implementations. In contrast, in most webframeworks, API declaration is implicit
-
-(Mention previous attemps at type-safe web, Yesod / web-routes + boomerang etc)
-### 4
-Three extensions are necessary:
-TypeOperators lets us use infix operators on the type level as constructors
-DataKinds promotes new type declarations to the kind level, makes type-level literals (strings and natural numbers) available, lets us use type-level lists and pairs in combination with typeoperators
-TypeFamilies: Type-level functions, map one set of types to another, come in two forms (type families, non-injective; data families, injective), more powerful than associated types
-### 5
-Here you can see servant's general syntax, we define an API type as a simple alias of some other type combinations
-strings are type-level strings, not actually values, represent path elements
-endpoints are separated by :<|>, all endpoints end in a method with content types and return types
-Capture captures path segments, but there are other combinators, for example for headers
-Everything that is used from the request is expressed in types, enforcing checkability, no "escape hatch" inside handlers to get request
-Every combinator has associated interpretations through typeclasses
-### 6
-Explain type alias, point out Capture
-Server is a type level function (type family), as mentioned earlier
-### 7
-If we expand server (in ghci with kind!) we can see the actual type of the
-function
-### 8
-Lets speak about some interpretations of these things
-### 9
-Servant server is the main interpretation that people are interested in, it's used
-for taking a type specification and creating a server from it
-Based on WAI, the web application interface, common abstraction for web servers which came out of the Yesod project. Implemented by the web server warp, which Yesod runs on
-### 10
-Explain snippet, path gets removed from server type (irrelevant for handler),
-route extracts string to value level
-### 11
-Explain echo server quickly
-### 12
-servant client allows generation of Haskell functions that query the API with the same types
-this makes for easy to use RPC for example
-### 13
-A lot of other interpretations exist for all kinds of things, mock servers for testing, foreign functions in various languages, documentation ...
-### 14
-Demo!
-1. Go quickly through code
-2. Run server, query with curl
-3. Open javascript function
-4. Show JS code in the thing
-5. Open the map itself
-6. Open GHCi, use client
-7. Generate docs
-### 15
-Conclusion
-Servant is pretty good, it's very easy to get started and it's great to raise the level of things that the compiler can tell you about when you do them wrong.
-### 16
-Drawbacks.
diff --git a/presentations/servant-2016/slides.tex b/presentations/servant-2016/slides.tex
deleted file mode 100644
index d5947eb9421a..000000000000
--- a/presentations/servant-2016/slides.tex
+++ /dev/null
@@ -1,137 +0,0 @@
-\documentclass[12pt]{beamer}
-\usetheme{metropolis}
-\usepackage{minted}
-
-\newenvironment{code}{\ttfamily}{\par}
-
-\title{servant}
-\subtitle{Defining web APIs at the type-level}
-
-\begin{document}
-\metroset{titleformat frame=smallcaps}
-\setminted{fontsize=\scriptsize}
-
-
-\maketitle
-
-\section{Introduction}
-
-\begin{frame}{Type-level DSLs?}
-  \begin{itemize}
-  \item (Uninhabited) types with attached ``meaning''
-  \item The Expression Problem (Wadler 1998)
-  \item API representation and interpretation are separated
-  \item APIs become first-class citizens
-  \end{itemize}
-\end{frame}
-
-\begin{frame}{Haskell extensions}
-  \begin{itemize}
-  \item TypeOperators
-  \item DataKinds
-  \item TypeFamilies
-  \end{itemize}
-\end{frame}
-
-\begin{frame}[fragile]{A servant example}
-  \begin{minted}{haskell}
-    type PubAPI = "pubs" :> Get ’[JSON] [Pub]
-             :<|> "pubs" :> "tagged"
-                         :> Capture "tag" Text
-                         :> Get ’[JSON] [Pub]
-  \end{minted}
-\end{frame}
-
-\begin{frame}[fragile]{Computed types}
-  \begin{minted}{haskell}
-    type TaggedPubs = "tagged" :> Capture "tag" Text :> ...
-
-    taggedPubsHandler :: Server TaggedPubs
-    taggedPubsHandler tag = ...
-  \end{minted}
-\end{frame}
-
-\begin{frame}[fragile]{Computed types}
-  \begin{minted}{haskell}
-    type TaggedPubs = "tagged" :> Capture "tag" Text :> ...
-
-    taggedPubsHandler :: Server TaggedPubs
-    taggedPubsHandler tag = ...
-
-    Server TaggedPubs ~
-    Text -> EitherT ServantErr IO [Pub]
-  \end{minted}
-\end{frame}
-
-\section{Interpretations}
-
-\begin{frame}{servant-server}
-  The one everyone is interested in!
-
-  \begin{itemize}
-  \item Based on WAI, can run on warp
-  \item Interprets combinators with a simple \texttt{HasServer c} class
-  \item Easy to use!
-  \end{itemize}
-\end{frame}
-
-\begin{frame}[fragile]{HasServer ...}
-  \begin{minted}{haskell}
-    instance (KnownSymbol path, HasServer sublayout)
-             => HasServer (path :> sublayout) where
-      type ServerT (path :> sublayout) m = ServerT sublayout m
-
-      route ...
-        where
-          pathString = symbolVal (Proxy :: Proxy path)
-  \end{minted}
-\end{frame}
-
-\begin{frame}[fragile]{Server example}
-  \begin{minted}{haskell}
-    type Echo = Capture "echo" Text :> Get ’[PlainText] Text
-
-    echoAPI :: Proxy Echo
-    echoAPI = Proxy
-
-    echoServer :: Server Echo
-    echoServer = return
-  \end{minted}
-\end{frame}
-
-\begin{frame}{servant-client}
-  \begin{itemize}
-  \item Generates Haskell client functions for API
-  \item Same types as API specification: For RPC the whole ``web layer'' is abstracted away
-  \item Also easy to use!
-  \end{itemize}
-\end{frame}
-
-\begin{frame}{servant-docs, servant-js ...}
-  Many other interpretations exist already, for example:
-  \begin{itemize}
-  \item Documentation generation
-  \item Foreign function export (e.g. Elm, JavaScript)
-  \item Mock-server generation
-  \end{itemize}
-\end{frame}
-
-\section{Demo}
-
-\section{Conclusion}
-
-\begin{frame}{Drawbacks}
-  \begin{itemize}
-  \item Haskell has no custom open kinds (yet)
-  \item Proxies are ugly
-  \item Errors can be a bit daunting
-  \end{itemize}
-\end{frame}
-
-\begin{frame}{Questions?}
-  Ølkartet: github.com/tazjin/pubkartet \\
-  Slides: github.com/tazjin/servant-presentation
-
-  @tazjin
-\end{frame}
-\end{document}