Network


Latest external collaboration on country level. Dive into details by clicking on the dots.

Hotspot


Dive into the research topics where Matija Pretnar is active.

Publication


Featured researches published by Matija Pretnar.


european symposium on programming | 2009

Handlers of Algebraic Effects

Gordon D. Plotkin; Matija Pretnar

We present an algebraic treatment of exception handlers and, more generally, introduce handlers for other computational effects representable by an algebraic theory. These include nondeterminism, interactive input/output, concurrency, state, time, and their combinations; in all cases the computation monad is the free-model monad of the theory. Each such handler corresponds to a model of the theory for the effects at hand. The handling construct, which applies a handler to a computation, is based on the one introduced by Benton and Kennedy, and is interpreted using the homomorphism induced by the universal property of the free model. This general construct can be used to describe previously unrelated concepts from both theory and practice.


The Journal of Logic and Algebraic Programming | 2015

Programming with algebraic effects and handlers

Andrej Bauer; Matija Pretnar

Abstract Eff is a programming language based on the algebraic approach to computational effects, in which effects are viewed as algebraic operations and effect handlers as homomorphisms from free algebras. Eff supports first-class effects and handlers through which we may easily define new computational effects, seamlessly combine existing ones, and handle them in novel ways. We give a denotational semantics of Eff and discuss a prototype implementation based on it. Through examples we demonstrate how the standard effects are treated in Eff , and how Eff supports programming techniques that use various forms of delimited continuations, such as backtracking, breadth-first search, selection functionals, cooperative multi-threading, and others.


Logical Methods in Computer Science | 2013

Handling Algebraic Effects

Gordon D. Plotkin; Matija Pretnar

Algebraic effects are computational effects that can be represented by an equational theory whose operations produce the effects at hand. The free model of this theory induces the expected computational monad for the corresponding effect. Algebraic effects include exceptions, state, nondeterminism, interactive input/output, and time, and their combinations. Exception handling, however, has so far received no algebraic treatment. We present such a treatment, in which each handler yields a model of the theory for exceptions, and each handling construct yields the homomorphism induced by the universal property of the free model. We further generalise exception handlers to arbitrary algebraic effects. The resulting programming construct includes many previously unrelated examples from both theory and practice, including relabelling and restriction in Milners CCS, timeout, rollback, and stream redirection.


logic in computer science | 2008

A Logic for Algebraic Effects

Gordon D. Plotkin; Matija Pretnar

We present a logic for algebraic effects, based on the algebraic representation of computational effects by operations and equations. We begin with the a-calculus, a minimal calculus which separates values, effects, and computations and thereby canonises the order of evaluation. This is extended to obtain the logic, which is a classical first-order multi-sorted logic with higher-order value and computation types, as in Levys call-by-push-value, a principle of induction over computations, a free algebra principle, and predicate fixed points. This logic embraces Moggis computational lambda-calculus, and also, via definable modalities, Hennessy-Milner logic, and evaluation logic, though Hoare logic presents difficulties.


conference on algebra and coalgebra in computer science | 2014

An Effect System for Algebraic Effects and Handlers

Andrej Bauer; Matija Pretnar

We present an effect system for algebraic effects and handlers. Because handlers may transform an effectful computation into a pure one, the effect system is non-monotone in the sense that effects do not just accumulate, but may also be deleted from types or generally transformed. We also provide denotational semantics for the effect system, based on a domain-theoretic model with partial equivalence relations. The semantics validates equational reasoning about effectful computations.


Logical Methods in Computer Science | 2014

Inferring Algebraic Effects

Matija Pretnar

We present a complete polymorphic effect inference algorithm for an ML-style language with handlers of not only exceptions, but of any other algebraic effect such as input & output, mutable references and many others. Our main aim is to offer the programmer a useful insight into the effectful behaviour of programs. Handlers help here by cutting down possible effects and the resulting lengthy output that often plagues precise effect systems. Additionally, we present a set of methods that further simplify the displayed types, some even by deliberately hiding inferred information from the programmer.


Electronic Notes in Theoretical Computer Science | 2015

An Introduction to Algebraic Effects and Handlers. Invited tutorial paper

Matija Pretnar

This paper is a tutorial on algebraic effects and handlers. In it, we explain what algebraic effects are, give ample examples to explain how handlers work, define an operational semantics and a type & effect system, show how one can reason about effects, and give pointers for further reading.


arXiv: Logic in Computer Science | 2017

On the expressive power of user-defined effects: effect handlers, monadic reflection, delimited control

Yannick Forster; Ohad Kammar; Sam Lindley; Matija Pretnar

We compare the expressive power of three programming abstractions for user-defined computational effects: Plotkin and Pretnars effect handlers, Filinskis monadic reflection, and delimited control without answer-type-modification. This comparison allows a precise discussion about the relative expressiveness of each programming abstraction. It also demonstrates the sensitivity of the relative expressiveness of user-defined effects to seemingly orthogonal language features. We present three calculi, one per abstraction, extending Levys call-by-push-value. For each calculus, we present syntax, operational semantics, a natural type-and-effect system, and, for effect handlers and monadic reflection, a set-theoretic denotational semantics. We establish their basic metatheoretic properties: safety, termination, and, where applicable, soundness and adequacy. Using Felleisens notion of a macro translation, we show that these abstractions can macro-express each other, and show which translations preserve typeability. We use the adequate finitary set-theoretic denotational semantics for the monadic calculus to show that effect handlers cannot be macro-expressed while preserving typeability either by monadic reflection or by delimited control. Our argument fails with simple changes to the type system such as polymorphism and inductive types. We supplement our development with a mechanised Abella formalisation.


Journal of Functional Programming | 2017

No value restriction is needed for algebraic effects and handlers

Ohad Kammar; Matija Pretnar

We present a straightforward, sound Hindley-Milner polymorphic type system for algebraic effects and handlers in a call-by-value calculus, which allows type variable generalisation of arbitrary computations, not just values. This result is surprising. On the one hand, the soundness of unrestricted call-by-value Hindley-Milner polymorphism is known to fail in the presence of computational effects such as reference cells and continuations. On the other hand, many programming examples can be recast to use effect handlers instead of these effects. Analysing the expressive power of effect handlers with respect to state effects, we claim handlers cannot express reference cells, and show they can simulate dynamically scoped state.


european symposium on programming | 2018

Explicit Effect Subtyping

Amr Hany Saleh; Georgios Karachalias; Matija Pretnar; Tom Schrijvers

As popularity of algebraic effects and handlers increases, so does a demand for their efficient execution. Eff, an ML-like language with native support for handlers, has a subtyping-based effect system on which an effect-aware optimizing compiler could be built. Unfortunately, in our experience, implementing optimizations for Eff is overly error-prone because its core language is implicitly-typed, making code transformations very fragile.

Collaboration


Dive into the Matija Pretnar's collaboration.

Top Co-Authors

Avatar

Andrej Bauer

University of Ljubljana

View shared research outputs
Top Co-Authors

Avatar
Top Co-Authors

Avatar
Top Co-Authors

Avatar

Sam Lindley

University of Edinburgh

View shared research outputs
Top Co-Authors

Avatar

Matija Lokar

University of Ljubljana

View shared research outputs
Top Co-Authors

Avatar

Gaëtan Gilbert

École normale supérieure de Lyon

View shared research outputs
Top Co-Authors

Avatar
Top Co-Authors

Avatar
Top Co-Authors

Avatar

Amr Hany Saleh

Katholieke Universiteit Leuven

View shared research outputs
Top Co-Authors

Avatar

Georgios Karachalias

Katholieke Universiteit Leuven

View shared research outputs
Researchain Logo
Decentralizing Knowledge