Tomas Petricek
email: t.petricek@kent.ac.uk
twitter: @tomaspetricek
Experiments to confirm hypotheses?
Build systems like engineers?
Prove theorems about theories?
Even physics is not as obvious!
Computations for asynchronous programming
Unified notion of context dependence
Types for working with external data sources
Programming as human data interaction
Abstractions and syntax for reactive, concurrent and asynchronous programming.
1: 2: 3: 4: 5: |
|
1: 2: 3: 4: 5: |
|
1: 2: 3: 4: 5: |
|
Async workflows and async sequences PADL 2011a
1: 2: 3: 4: 5: 6: 7: 8: |
|
Syntax to support monad-like abstractions
Further syntax requires further operations PADL 2014
Non-standard pattern matching PADL 2011b Haskell 2011
Different way of thinking about computations
1: 2: 3: |
|
\[\definecolor{leff}{RGB}{177,35,43} \definecolor{lcoeff}{RGB}{35,177,53} \definecolor{ltyp}{RGB}{147,43,127} \definecolor{lexpr}{RGB}{0,0,0} \definecolor{lkvd}{RGB}{0,45,177} \definecolor{lnum}{RGB}{43,177,93}\]
\(x:{\color{ltyp} \text{int}},~ y:{\color{ltyp} \text{int}} \vdash x+y : {\color{ltyp} \text{int}}\)
\(hello : {\color{ltyp} \text{string}} \vdash {\color{lkvd} \text{print}}~hello : {\color{ltyp} \text{unit}} {\scriptsize \;\&\;} {\color{leff} \{ \text{io} \} }\)
\(deadline : {\color{ltyp} \text{time}} {\scriptsize \;@\;} {\color{lcoeff} \{ \text{clock} \} } \vdash {\color{lkvd} \text{now}} \geq deadline : {\color{ltyp} \text{bool}}\)
\(\dfrac {\Gamma, x:{\color{ltyp} \tau_1} \vdash e : {\color{ltyp} \tau_2}} {\Gamma \vdash {\color{lkvd} \text{fun}}~x \rightarrow e : {\color{ltyp} \tau_1} \rightarrow {\color{ltyp} \tau_2}}\)
\(\dfrac {\Gamma, x:{\color{ltyp} \tau_1} \vdash e : {\color{ltyp} \tau_2 } {\scriptsize \;\&\;} {\color{leff} r} } {\Gamma \vdash {\color{lkvd} \text{fun}}~x \rightarrow e : {\color{ltyp} \tau_1} \xrightarrow{~\color{leff} r~} {\color{ltyp} \tau_2} {\scriptsize \;\&\;} {\color{leff} \emptyset}}\)
\(\dfrac {\Gamma, x:{\color{ltyp} \tau_1} {\scriptsize \;@\;} {\color{lcoeff} r\wedge s} \vdash e : {\color{ltyp} \tau_2 } } {\Gamma {\scriptsize \;@\;} {\color{lcoeff} r} \vdash {\color{lkvd} \text{fun}}~x \rightarrow e : {\color{ltyp} \tau_1} \xrightarrow{~\color{lcoeff} s~} {\color{ltyp} \tau_2}}\)
Dataflow coeffects (see tomasp.net/coeffects)
What is the context in which programs run?
Variables, resources, history, etc. ICALP 2013
Per-context and per-variable definitions ICFP 2014
Algebra of (co)effect annotations Festschrift 2016
1: 2: 3: 4: 5: 6: 7: |
|
1: 2: 3: 4: 5: 6: 7: |
|
Languages do not understand data
There is rarely explicit schema
Manually define types to capture it
Easier in dynamic languages
\(\emptyset \vdash e : \tau\)
\(\pi(~~~~~~~) \vdash e : \tau\)
Reading data from an RSS feed DDFP 2013 PLDI 2016
Structural shape inference
Language integration via type providers
Relative type safety
Pragmatic choices for usability
{title : string, author : {age : int}} {author : {age : float}}
{ title : option<string>, author : {age : float} }
{ coordinates : {lng:num, lat:num} } string
{ coordinates : {lng:num, lat:num} } + string
Given representative samples and an input value
\(S(d)\sqsubset S(d_1, \ldots, d_n)\)
Any program written using a type provider reduces
\(e_{user}[x\leftarrow {\color{mc}\text{new}}~C(d)] \rightsquigarrow^* v\)
Data journalism
Can we make data science easy for journalists?
1: 2: 3: 4: 5: 6: |
|
Python dictionaries {"key": value}
Generalised indexers .[ condition ]
Operation names sort_values
Data column names "Athlete"
The Gamma (see gamma.turing.ac.uk) ECOOP 2017
Type providers for member generation
Cognitive cost of interactions
Fancy types for the masses!
Adding spreadsheet-like live experience
\[\definecolor{cc}{RGB}{204,82,34} \definecolor{mc}{RGB}{0,0,153} \frac {\Gamma \vdash e : {\color{cc}[f_1:\tau_1, \ldots, f_n:\tau_n]}} {\Gamma \vdash e.\text{drop}~f_i : {\color{cc} [f_1:\tau_1, \ldots, f_{i-1}:\tau_{i-1}, f_{i+1}:\tau_{i+1}, \ldots, f_n:\tau_n]}}\]
\[\frac {\Gamma \vdash e : {\color{mc} C_1}} {\Gamma \vdash e.\text{drop}~f_i : {\color{mc} C_2}} \quad{\small \text{where}}\]
\[\begin{array}{l} \\[-0.5em] {fields({\color{mc} C_2}) = {\color{mc} \{f_1:\tau_1, \ldots, f_{i-1}:\tau_{i-1}, f_{i+1}:\tau_{i+1}, \ldots, f_n:\tau_n\}}}\\ {fields({\color{mc} C_1}) = {\color{mc} \{f_1:\tau_1, \ldots, f_n:\tau_n\}}} \end{array}\]
Row types and phantom types
Session types for communication
Add your own fancy type here!
SpreadsheetsEasy to use Simple problems Not reproducible |
ProgrammingNeeds expert skills Internet-scale Open & transparent |
What makes spreadsheets so easy to learn and use?
How can programming tools learn from Excel?
Think of programming as interaction!
Live previews (see gamma.turing.ac.uk) ECOOP 2017
Tomas Petricek
t.petricek@kent.ac.uk | @tomaspetricek
Programming 2018 T. Petricek. What we talk about when we talk about monads. The Art, Science, and Engineering of Programming, Vol. 2, Issue 3, Article 12.
Onward 2015 Tomas Petricek. Against a universal definition of 'type'. In Onward! pp. 254-266, ISBN 9781450336888, ACM 2015
AISB 2014 T. Petricek. What can programming language research learn from the philosophy of science? In proceedings of AISB Conference, selected papers, ed. Rodger Kibble, 2014.
PADL 2014 T. Petricek and D. Syme. The F# computation expression Zoo. In proceedings of PADL, pp. 33-48, Springer 2014.
Haskell 2011 T. Petricek, Alan Mycroft and Don Syme. Extending monads with pattern matching. In proceedings of Haskell Symposium, ACM SIGPLAN Notices. vol. 46. no. 12. ACM, 2011.
PADL 2011a D. Syme, T. Petricek and D. Lomov. The F# asynchronous programming model. In proceedings of PADL workshop, pp.205–219, Springer Berlin Heidelberg 2011.
PADL 2011b T. Petricek and D. Syme. Joinads: a retargetable control-flow construct for reactive, parallel and concurrent programming. In proceedings of PADL, pp.205–219, Springer 2011.
ICFP 2014 T. Petricek, D. Orchard and A. Mycroft. Coeffects: A calculus of context dependent computation. In proceedings of ICFP, pp. 123–135, ISBN 9781450328739, ACM 2014.
ICALP 2013 T. Petricek, D. Orchard and A. Mycroft. Coeffects: Unified static analysis of context-dependence. ICALP 2013, In Automata, Languages, and Programming. pp. 385–397. Springer 2013.
Festschrift 2016 A. Mycroft, D. Orchard, T. Petricek. Effect systems revisited – control-flow algebra and semantic. In Semantics, Logics, and Calculi, pp. 1-32, ISBN 9783319278094, Springer 2016
ECOOP 2017 T. Petricek. Data exploration through dot-driven development. In Proceedings of ECOOP 2017. Associated software artifact has been evaluated and archived in DARTS, vol. 3, no. 2, pp. 12:1–12:2, 2017.
PLDI 2016 T. Petricek, D. Syme, G. Guerra. Types from data: Making structured data first-class citizens in F#. In proceedings of PLDI, pp. 477-490, ISBN 9781450342612. ACM 2016
DDFP 2013 D. Syme, K. Battocchi, K. Takeda, D. Malayeri and T. Petricek. Themes in information-rich functional prog¬¬ramming for internet-scale data sources. DDFP Workshop, pp. 1–4, ISBN 9781450318716, ACM 2013.