Research Associate in the
Digital Technology Group working on
programming language approaches to computational science with Andrew Rice. I am part
of the NAPS project
(New Approaches to Programming in the Sciences).
Office:  SN15 
Tel:  +44(0)1223 763649 
Email:  dominic.orchard at cl.cam.ac.uk 
 
Address: 
University of Cambridge
Computer Laboratory
15 JJ Thomson Avenue
Cambridge CB3 0FD

 
College: 
Queens' College (from
October 2014 I will be a Teaching Associate at Queens') 

Research interests
 Programming language design and semantics
 Mathematically structured programming
 Effect and coeffect systems
 Embedded domainspecific languages (esp. for parallelisation)
 Applying programming language research to computational science
I was previously a member of
the Cambridge
Programming Research Group (part of the Programming, Logic and Semantics Group), where I did my PhD.

News
July 2014
Coorganised and cochaired the
Workshop on Programming Language Evolution
at ECOOP 2014, and gave a talk on
Evolving Fortran types with inferred unitsofmeasure
[slides].
June 2014
At this year's ICFP I have 3 papers:
Attended ICCS 2014,
presenting my paper A computational science
agenda for programming language research (with Andrew Rice).
May 2014
My PhD Dissertation, Programming contextual computations,
is finally online as a
a University of Cambridge technical report. Let me know if you spot
any typos!
March 2014
I attended the Software Sustainability Institute's Collaborations Workshop 2014 (CW14), Oxford.
I wrote a book review of Computational Semantics with Functional
Programming, by Jan van Eijck and Christina Unger for
JFP. Preprint version available here.
I gave a talk at Fun in the Afternoon, hosted at Facebook
in London, on indexed monads.
Code and slides are available.
Andy Rice and I have had our paper "A computational science
agenda for programming language research" accepted at
ICCS'14 [preprint PDF].
February 2014
Raoul GabrielUrma, Alan Mycroft,
and I are organising the Workshop on Programming
Language Evolution 2014, colocated with ECOOP 2014 this year. Submission deadline May 12th.
I am on the Artefact Evaluation Committee (AEC) for ECOOP 2014.
October 2013
I attended SPLASH 2013 in
Indianapolis, presenting at WRT'13
[PDF].
September 2013
Andy Rice and I have
had our paper Upgrading Fortran source code using automatic refactoring
accepted to WRT'13 at
SPLASH 2013. [PDF]
Attended ICFP 2013 and presented my paper
Automatic SIMD Vectorization for Haskell (joint work
with Petersen and Glew). (talk also given
at the Computer Laboratory).
[
Older news items]
PhD Dissertation (finally online! May '14)
 Programming contextual computations
Dominic Orchard, University of Cambridge, 2014,
Technical Report PDF
Show abstract >>>
Modern computer programs are executed in a variety of different
contexts: on servers, handheld devices, graphics cards, and across
distributed environments, to name a few. Understanding a program’s
contextual requirements is therefore vital for its correct
execution. This dissertation studies contextual computations, ranging
from applicationlevel notions of context to lower level notions of
context prevalent in common programming tasks. It makes contributions
in three areas: mathematically structuring contextual computations,
analysing contextual program properties, and designing languages to
facilitate contextual programming.
Firstly, existing work which
mathematically structures contextual computations using comonads (in
programming and semantics) is analysed and extended. Comonads are
shown to exhibit a shape preservation property which restricts their
applicability to a subset of contextual computations. Subsequently,
novel generalisations of comonads are developed, including the notion
of an indexed comonad, relaxing shapepreservation restrictions.
Secondly, a general class of static analyses called coeffect systems
is introduced to describe the propagation of contextual requirements
throughout a program. Indexed comonads, with some additional
structure, are shown to provide a semantics for languages whose
contextual properties are captured by a coeffect analysis.
Finally,
language constructs are presented to ease the programming of
contextual computations. The benefits of these language features, the
mathematical structuring, and coeffect systems are demonstrated by a
language for container programming which guarantees optimisations and
safety invariants.
Publications
 (June '14)
Embedding effect systems in Haskell
Dominic Orchard, Tomas Petricek.
Haskell Symposium 2014 [
PDF]
Show abstract >>>
Monads are now an everyday tool in functional programming for abstracting
and delimiting effects. The link between monads and
effect systems is wellknown, but monads provide a much more
coarsegrained view of effects. Whilst effect systems capture
finegrained information about the effects, monads provide
only a binary view: effectful or pure.
Recent theoretical work has unified finegrained effect systems
with monads using a monadlike structure indexed by a monoid of effect
annotations (called parametric effect monads).
This aligns the power of monads with the power of effect systems.
This paper leverages recent advances in Haskell's type system (as
provided by GHC) to embed this approach in Haskell, providing
userprogrammable effect systems. We explore a number of practical
examples that make Haskell even better and safer for effectful
programming. Along the way, we relate the examples to other
concepts, such as Haskell's implicit parameters and coeffects.
 (June '14)
Temporal semantics for a live coding language
Sam Aaron, Dominic Orchard, Alan Blackwell.
Workshop on Functional Art and Music (FARM) 2014 [
PDF]
Show abstract >>>
Sonic Pi is a music live coding language that has been designed for
educational use as a first programming language. However, it is
not straightforward to achieve the necessary simplicity of a first language
in a music live coding setting, for reasons largely related to the
manipulation of time. The original version of Sonic Pi used a 'sleep'
function for managing time, blocking computation
for a specified time period. However, while this approach was conceptually
simple, it resulted in badly timed music, especially when multiple musical
threads were executing concurrently. This paper describes an alternative
programming approach for timing (implemented in Sonic Pi v2.0) which
maintains syntactic compatibility with v1.0, yet provides accurate
timing via interaction between real time and a "virtual time".
We provide a formal specification of the temporal behaviour of Sonic Pi,
motivated in relation to other recent approaches to the semantics of time in
live coding and general computation. We then define a monadic model of the
Sonic Pi temporal semantics which is sound with respect to this
specification, using Haskell as a metalanguage.

(May '14)
Coeffects: A calculus of contextdependent computation
Tomas Petricek, Dominic Orchard, Alan Mycroft.
to appear at ICFP 2014 [
PDF]
Show abstract >>>
The notion of context in functional languages no longer refers just to
variables in scope. Context can capture additional properties of the
variables (usage patterns in linear logics; caching requirements in
dataflow languages) as well as additional resources or properties of
the execution environment (rebindable resources; platform version in a
crossplatform application). The recently introduced notion of
coeffects captures the latter, wholecontext properties, but it failed
to capture finegrained pervariable properties. We remedy this by
developing a generalized coeffect system with annotations indexed by a
coeffect shape. By instantiating a concrete shape, our system captures
previously studied flat (wholecontext) coeffects, but also structural
(pervariable) coeffects, making it more practically useful. We show
that the structural system enjoys desirable syntactic properties and
we give its categorical semantics using extended notions of indexed
comonad. The examples presented in this paper are based on analysis
of established language features (liveness, linear logics, dataflow,
dynamic scoping) and we argue that such contextaware properties will
also be useful for future development of langua

A computational science agenda for programming
language research
Dominic Orchard, Andrew Rice.
to appear at International Conference on Computational Science, 2014
[
preprint PDF]
Show abstract >>>
Scientific models are often expressed as large and complicated
programs. These programs embody numerous assumptions made by the
developer (e.g., for differential equations, the discretization
strategy and resolution). The complexity and pervasiveness of these
assumptions means that often the only true description of the model
is the software itself. This has led various researchers to call
for scientists to publish their source code along with their
papers. We argue that this is unlikely to be beneficial since it is
almost impossible to separate implementation assumptions from the
original scientific intent. Instead we advocate higherlevel
abstractions in programming languages, coupled with lightweight
verification techniques such as specification and type systems. In
this position paper, we suggest several novel techniques and outline
an evolutionary approach to applying these to existing and future
models. Onedimensional heat flow is used as an example throughout.

The semantic marriage of monads and effects (extended abstract)

Upgrading Fortran source code using automatic refactoring
Dominic Orchard, Andrew Rice.
WRT'13 (ACM Workshop on Refactoring Tools 2013,
colocated with SPLASH 2013)
[
PDF]
Show abstract >>>
Many of the computer models used in scientific research have been
developed in Fortran over many years. This evolutionary process
means these models inevitably utilise deprecated features and idioms
of the language that impede software maintenance. To mitigate this,
we built CamFort, an opensource automated refactoring tool
for upgrading Fortran source code. We describe
functionality in CamFort for removing equivalence statements
and common blocks, and for deriving structured data types, and we
give examples of how these transformations can benefit codebase
robustness.

Automatic SIMD Vectorization for Haskell
Leaf Petersen, Dominic Orchard, Neal Glew.
Proceedings of ICFP 2013 (Boston, MA, USA)
[
PDF]
Show abstract >>>
Expressing algorithms using immutable arrays greatly simplifies the
challenges of automatic SIMD vectorization, since several important
classes of dependency violations cannot occur. The Haskell programming
language provides libraries for programming with immutable arrays, and
compiler support for optimizing them to eliminate the overhead of
intermediate temporary arrays. We de scribe an implementation of
automatic SIMD vectorization in a Haskell compiler which gives
significant vector speedups for a range of programs written in a
natural programming style. We compare performance with that of
programs compiled by the Glasgow Haskell Compiler.

Coeffects: Unified static analysis of contextdependence
Tomas Petricek, Dominic Orchard, and Alan Mycroft.
Proceedings of
ICALP'13 (Riga, Latvia)
[
PDF]
Show abstract >>>
Monadic effect systems provide a unified way of tracking
effects of computations, but there is no unified mechanism for tracking
how computations rely on the environment in which they are executed.
This is becoming an important problem for modern software  we need
to track where distributed computations run, which resources a program
uses and how they use other capabilities of the environment.
We consider three examples of contextdependence analysis: liveness
analysis, tracking the use of implicit parameters, and calculating caching
requirements for dataflow programs. Informed by these cases, we present
a unified calculus for tracking context dependence in functional languages
together with a categorical semantics based on indexed comonads. We
believe that indexed comonads are the right foundation for constructing contextaware languages and type systems and that following an approach akin to monads can lead to a widespread use of the concept.

A Notation for Comonads
Dominic Orchard and Alan Mycroft.
(to appear) LNCS postproceedings of IFL 2012.
[PDF]
[
code]
Show abstract >>>
The categorytheoretic concept of a monad occurs widely as
a design pattern for functional programming with effects. The utility and
ubiquity of monads is such that some languages provide syntactic sugar
for this pattern, further encouraging its use. We argue that comonads,
the dual of monads, similarly provide a useful design pattern, capturing notions
of context dependence. However, comonads remain relatively
underused compared to monads—due to a lack of knowledge of the design pattern
along with the lack of accompanying simplifying syntax.
We propose a lightweight syntax for comonads in Haskell, analogous to
the donotation for monads, and provide examples of its use. Via our
notation, we also provide a tutorial on programming with comonads.

The four Rs of programming language design
Dominic Orchard
Addendum to ONWARD '11 Proceedings of the 10th SIGPLAN symposium on New ideas, new paradigms, and reflections on programming and software.
[
PDF]
[
@ACM DL]
 Efficient and Correct Stencil Computation via Pattern Matching and Static Typing
Dominic Orchard and Alan Mycroft
IFIP Working Conference on DomainSpecific Languages, Bordeaux, September 2011 (
DSL 2011')
[
PDF at the arXiv] [
implementation]
Show abstract >>>
Stencil computations, involving operations over the elements of an array, are a common programming pattern in scientific computing, games, and image processing. As a programming pattern,
stencil computations are highly regular and amenable to optimisation and parallelisation. However,
generalpurpose languages obscure this regular pattern from the compiler, and even the programmer,
preventing optimisation and obfuscating (in)correctness. This paper furthers our work on the Ypnos
domainspecific language for stencil computations embedded in Haskell. Ypnos allows declarative,
abstract specification of stencil computations, exposing the structure of a problem to the compiler
and to the programmer via specialised syntax. In this paper we show the decidable safety guarantee that wellformed, welltyped Ypnos programs cannot index outside of array boundaries. Thus
indexing in Ypnos is safe and runtime bounds checking can be eliminated. Program information is
encoded as types, using the advanced typesystem features of the Glasgow Haskell Compiler, with
the safeindexing invariant enforced at compile time via type checking.
 Haskell Type Constraints Unleashed
Dominic Orchard and Tom Schrijvers
10
^{th} International Symposium on Functional and Logic Programming,
FLOPS 2010, Sendai, Japan, April 2010
[
On SpringerLink]
[
Author's Copy with corrections]  [
Accompanying technical report]  [
Prototype
implementation]
Show abstract >>>
The popular Glasgow Haskell Compiler extends the Haskell 98
type system with several powerful features, leading to an expressive lan
guage of type terms. In contrast, constraints over types have received
much less attention, creating an imbalance in the expressivity of the
type system. In this paper, we rectify the imbalance, transferring familiar typelevel constructs, synonyms and families, to the language of
constraints, providing a symmetrical set of features at the typelevel and
constraintlevel. We introduce constraint synonyms and constraint families, and illustrate their increased expressivity for improving the utility
of polymorphic EDSLs in Haskell, amongst other examples. We provide
a discussion of the semantics of the new features relative to existing type
system features and similar proposals, including details of termination.
 Ypnos : Declarative Parallel Structured Grid Programming
Dominic Orchard, Max Bolingbroke, and Alan Mycroft
5th ACM SIGPLAN Workshop on Declarative Aspects of Multicore Programming, DAMP '10. Madrid, Spain, 2010.
[
PDF + corrections]
[
ACM Portal]
Show abstract >>>
A fully automatic, compilerdriven approach to parallelisation can result in unpredictable time and space costs for compiled code. On the other hand, a fully manual approach to parallelisation can be long, tedious, prone to errors, hard to debug, and often architecturespecific. We present a declarative domainspecific language, Ypnos, for expressing structured grid computations which encourages manual specification of causally sequential operations but then allows a simple, predictable, static analysis to generate optimised, parallel implementations. We introduce the language and provide some discussion on the theoretical aspects of the language semantics, particularly the structuring of computations around the category theoretic notion of a comonad.
 muCell  Interdisciplinary Research in Modelling and Simulation of Cell Spatial Behaviour
Dominic Orchard, Jonathan Gover, Lewis Herrington, James Lohr, Duncan Stead, Cathy Young, Sara Kalvala
Reinvention: a Journal of Undergraduate Research, Volume 2, Issue 1, April 2009
[
Online version]  [
PDF version]  [
Shortened PDF version]
 Integrating Lucid's Declarative Dataflow Paradigm into ObjectOrientation
Dominic Orchard and Steve Matthews
Mathematics in Computer Science,
2(1), November 2008
[
On SpringerLink]
Old drafts and notes (some may be resurrected someday)

Categorical Programming for Data Types with Restricted Parametericity
Dominic Orchard and Alan Mycroft.
(Rejected from the TFP 2012 postproceedings)
[
Draft PDF].
(An earlier version appeared in the preproceedings of TFP 2012 as "Mathematical Structures for Data Types with Restricted Parametricity".)
Show abstract >>>
Many concepts from category theory have proven useful as tools
for program abstraction, particularly in functional programming.
For example, many parametric data types admit operations
defining a functor and related structures such as a
monad. However, some parametric data types whose
operations are restricted in their parametricity are not amenable to
traditional categorytheoretic abstractions in Haskell, despite appearing to
satisfy the mathematical definitions.
This paper explains the limitations of various traditional categorytheoretic
approaches in Haskell, giving a precise account of their
categorytheoretic meaning and the categorical implications of
restricted parametricity arising from adhoc polymorphism provided by
type classes in Haskell.
Following from this analysis, we generalise Haskell's notions of functors,
monads and comonads, making use of GHC's new constraint kinds
extension, providing techniques for structuring programs with both
unrestricted and restricted polymorphism.

Should I use a Monad or a Comonad?
Dominic Orchard. Unpublished work in progress (Dec 2011). [
draft]
Show details >>>
Shall we be pure or impure? Today we will be pure but how? This paper explores and formalises the situations in which both a monad and a comonad can be used to structure a particular notion of computation. Various example are considered, and discussion on chosing between a monad and a comonad is provided.
Articles

Book review: Computational Semantics with Functional Programming
by Jan van Eijck and Christina Unger
Dominic Orchard, Journal of Functional Programming (April, 2014)
[preprint PDF] [JFP online]

The Unreasonable Effectiveness of (Basic Secondary School) Mathematics
Dominic Orchard, Jesus College Annual Report 2012, (p.2728) [magainze PDF] (has corrupted figure on p.28)
[article PDF]
Talks

6^{th} September 2014 
Temporal semantics for a live coding language
FARM 2014 (Functional art, music, and modelling) workshop, Gothenburg, Sweden

4^{th} September 2014 
Embedding effect systems in Haskell, Haskell Symposium 2014, Gothenburg, Sweden [video]
[slides]

28^{th} July 2014 
Evolving Fortran types with inferred unitsofmeasure,
Workshop on Programming Language Evolution, ECOOP, 2014, Uppsala, Sweden,
[slides]

17^{th} June 2014 
Dualising effect systems to understand resources and context dependence,
Mobility Reading Group, Department of Computing, Imperial College London, UK
[slides]

12^{th} June 2014 
A computational science agenda for programming language research,
International Conference of Computational Science 2014, Cairns, Australia
[slides]

2^{nd} June 2014 
A computational science agenda for programming language research,
Digital Technology Group, Computer Laboratory, University of Cambridge

26^{th} March 2014

Separating concerns for better reproducibility (lightning
talk), Software Sustainibility Institute, Collaborations Workshop 2014,
Oxford, UK

12^{th} March 2014 
Fun with Indexed Monads, Fun in the Afternoon, hosted
at Facebook, London [Slides and code]
 12^{th} November 2013 
Upgrading Fortran source code using automatic refactoring
and lightweight verification extensions,
Cambridge Centre for Climate Science, Department of Geography,
University of Cambridge
 27^{th} October 2013 
Upgrading Fortran soure code using automatic refactoring,
Workshop on Refactoring Tools (WRT'13)
at SPLASH 2013, Indianapolis, USA
[slides]
 21^{st} October 2013 
Upgrading Fortran soure code using automatic refactoring,
DTG Seminar, Computer Laboratory, University of Cambridge, UK
 25^{th} September 2013 
Automatic SIMD vectorization for Haskell
ICFP (International Conference on Functional Programming) 2013, Boston, MA, USA
[slides]
 17^{th} September 2013 
Automatic SIMD vectorization for Haskell
CPRG Seminar, Computer Laboratory, Cambridge, UK
[slides]
 13^{th} November 2012 
Programs in context  Intelligent and Adaptive Systems Research Group, Department of Computer Science, University of Warwick [slides]
 5^{th} November 2012 
Programs in context  Digital Technology Group Seminar, Computer Laboratory, Cambridge
 30^{st} August 2012  A Notation for Comonads 
Implementation and Application of Functional Languages 2012 (IFL'12), Oxford,
UK [slides] [video].
 22^{nd} June 2012  A Notation for Comonads, Context, and Intensional Programming 
Algebra of Programming informal seminar, Department of Computer Science, Oxford, UK
 13^{th} June 2012  Mathematical Structures for Data Types with Restricted Parametericity, Trends in Functional Programming 2012, St. Andrews, Scotland [slides]
 8^{th} June 2012  Mathematical Structures for Data Types with Restricted Parametericity, CPRG Seminar, Computer Laboratory, Cambridge
 27^{th} April 2012  The Unreasonable Effectivness of (High School) Mathematics, 5^{th} Annual Jesus College Graduate Conference, Cambridge [slides] [video]
 23^{rd} Februrary 2012  Coeffect systems: capturing contextdependence,
University of Strathclyde, Mathematically Structured Programming Group Seminar, Glasgow (slides on request)
 27^{th} October 2011  The Four Rs of Programming Language Design, Onward! Essay Presentation, SPLASH 2011, Portland, Oregon, USA.
 7^{th} October 2011  Coeffect Systems and Typing  (with Tomas Petricek), CPRG Seminar, Computer Laboratory, Cambridge [slides]
 7^{th} September 2011  Efficient and Correct Stencil Computations via Pattern Matching and Type Checking  IFIP Working Conference on DSLs, DSL 2011, Bordeaux, France [slides]
 2^{nd} September 2011  Efficient and Correct Stencil Computations via Pattern Matching and Type Checking  CPRG Seminar, Computer Laboratory, Cambridge
 2^{nd} June 2011  Programming with Comonads and Codo Notation  Tallinn University of Technology, Institute of Cybernetics, Estonia [slides]
 20^{th} May 2011  When Monads and Comonads Overlap  CPRG Seminar, Computer Laboratory, Cambridge
 13^{th} May 2011  Programming with Comonads and Codo Notation  CPRG Seminar, Computer Laboratory, Cambridge
 26^{th} November 2010  repeat lecture  Mathematically Structuring
Programming Languages
 Research
Students Lecture Course, Cambridge,
UK. [slides,
notes, and examples]
 20^{th} August 2010 
Rethinking Language Design for Parallelization, Intel Labs, Santa Clara, California, USA [slides]
 2^{nd} June 2010  Programming with monads combined
with comonads
 ICFP
PC Workshop 2010, Microsoft Research, Cambridge, UK
[slides]
 14^{th} May 2010  lecture  Mathematically Structuring
Programming Languages
 Research
Students Lecture Course, Cambridge,
UK. [slides,
notes, and examples]
 21^{st} April 2010  Haskell Type Constraints
Unleashed
 FLOPS
2010, Sendai, Japan (given as a video talk due to continued
airflight restrictions in the UK at the time) [slides] [video]
 17^{th} February 2010  Haskell Type Constraints Unleashed  Fun in the Afternoon, Standard Chartered Bank, London [slides]
 12^{th} February 2010  Haskell Type Constraints Unleashed  CPRG Seminar, Computer Laboratory, Cambridge
 19^{th} January 2010  Ypnos: Declarative, Parallel Structured Grid Programming, DAMP '10, Madrid, Spain [slides]
 20^{th} November 2009  Ypnos: Declarative, Parallel Structured Grid Programming, CPRG Seminar, Computer Laboratory, Cambridge [slides]
 1^{st} May 2009  Programming Language Design, Jesus College Graduate Symposium '09 [slides]
 7^{th} April 2009  Lucian: Dataflow and Object Orientation  BCTCS '09, University of Warwick, UK [slides]
[abstract]
 13^{th} March 2009  Interoperation of Lucid's Dataflow paradigm and Objectorientation with a Coalgebraic Semantics  CPRG Seminar, Computer Laboratory, Cambridge
Commitees
 PLE 2014 (Programming Language Evolution) Cochair and Program
Commitee
 ECOOP 2014 Artefact Evaluation Commitee
 IFL 2013 (Implementation and Application
of Functional Languages) Program Commitee
Teaching
I supervise Part II (final year) and Part III (masters) projects. I have written
down some proposals for potential projects.
Please get in touch if you are interested ni me supervising your project.
Previous projects supervised:
 The Formatting Problem for code (201314) (Part III)
 Dimensions types in Fortran (201314) (Part III)
 Distributed Programming with Rebindable Resources (201314)
 Implementing the Codo Syntax for Comonads in GHC (201213)
 GPU accelerating the Ypnos programming language (201213)
 VisualLucid IDE  A visual approach to dataflow programming (201112)
 Accessing Standard ML Constructs From Java Across Language Domains (201112)

Parallelisation of Java for Graphics Processors  Peter Calvert (200910)
 Reconsidering Lucid  a modern approach  Jonas Kaiser (200910)
I have supervised, or am currently supervising, the following courses:
 Denotational Semantics (2014)
 Logic and Proof (201314)
 Semantics (Michaelmas and Lent Term, 20092014)
 Concepts in Programming Languages (Easter term, 20102011)
 Optimising Compilers (Michaelmas term, 20082009, 201314)
 Comparative Architectures (Lent Term, 2009)
I gave a lecture entitled "Mathematically Structuring Programming Languages" as part of the "Current Research Topics" course at the Cambridge Computer Laboratory in May, 2010 and again in November, 2010, as part of a series of lectures given by students in the CPRG (lectures
note, slides, errata, and examples).
Academic
I received my MEng in Computer Science in July 2008 from the Department of Computer Science, Universiy of Warwick.