\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}