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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
\documentclass{beamer}
\title{Cloogle}
\subtitle{A programming language search engine and its applications}
\author{Camil Staps}
\date{January 5\textsuperscript{th}, 2018}
\usetheme{Szeged}
\usecolortheme{cloogle}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\newcommand{\module}[2]{#2\\[-4pt]\color{gray}{\tiny(#1)}}
\tikzstyle{block}=[rectangle,align=center]
\tikzset{
doc/.pic={
\coordinate (-east) at (0.309,0);
\coordinate (-south) at (0,-0.4);
\draw[pic actions] (-0.309,-0.4) -- ++(0,0.8) -- ++(0.518,0) -- ++(0,-0.1) -- ++(0.1,0) -- ++(0,-0.7) -- cycle;
\draw[pic actions] (0.209,0.4) -- ++(0.1,-0.1);
\draw[pic actions] (-0.209,-0.1) -- ++(0.418,0);
\draw[pic actions] (-0.209, 0) -- ++(0.418,0);
\draw[pic actions] (-0.209, 0.1) -- ++(0.418,0);
},
db/.pic={
% https://tex.stackexchange.com/a/397862/23992
\coordinate (-west) at (-0.3,0);
\coordinate (-east) at ( 0.3,0);
\coordinate (-south) at (0,-0.42);
\foreach \y in {-0.33,-0.1,0.13} {
\draw[fill=white] (-0.3,\y) to [looseness=0.5,bend right=90] ++(0.6,0)
-- ++(0,0.2) to [looseness=0.5,bend left=90] ++(-0.6,0)
-- ++(0,-0.2);
\draw (-0.3,\y+0.2) edge[looseness=0.5,bend left=90] ++(0.6,0);
}
}
}
\usepackage{minted}
\setminted{fontsize=\small}
\begin{document}
\maketitle
\section{Background}
\begin{frame}[fragile]{Background}
What is wrong with this code?
\begin{minted}[gobble=2]{clean}
incAll :: [Int] -> [Int]
incAll [] = []
incAll [x:xs] = [x+1:incAll xs]
sortByKey :: [(a,b)] -> [(a,b)] | < a
sortByKey [] = []
sortByKey [(k,v):xs] = sortByKey ls ++ [(k,v):sortByKey hs]
where (ls,hs) = partition (\(k`,_) -> k > k`) xs
\end{minted}
\pause
Better:
\begin{minted}[gobble=2]{clean}
incAll :== map ((+) 1)
sortByKey :== sortBy (on (<) fst)
\end{minted}
\end{frame}
\begin{frame}{Background}
Lack of abstraction due to...
\begin{itemize}
\item Poor conceptualisation of the programmer?
\item Poor knowledge of the standard libraries?
\begin{itemize}
\item \enquote{There is this function \texttt{map}, but where is it defined?}
\end{itemize}
\end{itemize}
Solution: build a search engine!
\end{frame}
\begin{frame}{History}
\begin{itemize}
\item February 2016: PHP regex search
\pause
\item April: function type search; moved to Clean
\pause
\item June: type definition search; included classes and generics
\pause
\item August: included macros
\pause
\item October: moved to Docker containers; caching
\pause
\item November: unify with type synonyms
\end{itemize}
\end{frame}
\begin{frame}{Architecture}
\centering
\footnotesize
\def\tikzsource{%
\pic (src) at (-5,3) {doc};
}
\def\tikzbuilddb{%
\node (cocl) at (-2.5, 3.5 ) {\module{Clean}{Clean compiler}};
\node (ppr) at (-2.5, 2.5 ) {\module{Clean}{Pretty printer}};
\pic (db) at ( 0, 2.98) {db};
\node[right=5pt of db-east,draw=none] {\module{\tiny JSON}{\scriptsize Database}};
\draw[->] ($(src-east)+(0,0.18)$) -- (cocl.west);
\draw[->] ($(src-east)-(0,0.18)$) -- (ppr.west);
\draw[->] (cocl.east) -- ($(db-west)+(0,0.18)$);
\draw[->] (ppr.east) -- ($(db-west)-(0,0.18)$);
}
\def\tikzbackend{%
\node (web) at (0, 1) {\module{Clean, PHP, JS}{\textbf{cloogle.org}}};
\node (uni) at (2, 2) {\module{Clean}{Type unifier}};
\draw (uni) -- (web);
\draw[->] (db-south) -- (web);
}
\def\tikzfrontend{%
\node (hljs) at (-2, 0.5) {\module{JS}{clean.js}};
\draw (hljs) -- (web);
}
\def\tikzfrontendsrc{%
\node (pygm) at (-2.25, 1.5) {\module{Python}{pygments}};
\draw[->] (src-south) -- (pygm);
\draw (pygm) -- (web);
}
\def\tikzstats{%
\node (stats) at (3, 1) {\module{Bash, JS, PHP, SQL}{Log \& Statistics}};
\draw (web) -- (stats);
}
\def\tikzclientA{%
\node (cli) at (-2,-2) {\module{Python}{CLI app}};
\draw[->] (web) -- (cli);
}
\def\tikzclientB{%
\node (tgm) at (0,-2) {\module{Python}{Telegram bot}}; % TODO more frontends?
\draw[->] (web) -- (tgm);
}
\def\tikzclientC{%
\node (vim) at (2,-2) {\module{Vim}{vim-clean}};
\draw[->] (web) -- (vim);
}
\begin{tikzpicture}[every node/.style={draw,block}]
\useasboundingbox (-5,-4) rectangle (5,4);
\only<1->\tikzsource
\only<1-4>{\node[below=5pt of src-south,draw=none] {\scriptsize Source code};}
\only<2->{\tikzbuilddb}
\only<3->{\tikzbackend}
\only<4->{\tikzfrontend}
\only<5->{\tikzfrontendsrc}
\only<6->{\tikzstats}
\only<7->{\tikzclientA}
\only<8->{\tikzclientB}
\only<9->{\tikzclientC}
\end{tikzpicture}
\end{frame}
\end{document}
|