Results 1 
3 of
3
Kleisli arrows of outrageous fortune
, 2011
"... When we program to interact with a turbulent world, we are to some extent at its mercy. To achieve safety, we must ensure that programs act in accordance with what is known about the state of the world, as determined dynamically. Is there any hope to enforce safety policies for dynamic interaction b ..."
Abstract

Cited by 5 (1 self)
 Add to MetaCart
When we program to interact with a turbulent world, we are to some extent at its mercy. To achieve safety, we must ensure that programs act in accordance with what is known about the state of the world, as determined dynamically. Is there any hope to enforce safety policies for dynamic interaction by static typing? This paper answers with a cautious ‘yes’. Monads provide a type discipline for effectful programming, mapping value types to computation types. If we index our types by data approximating the ‘state of the world’, we refine our values to witnesses for some condition of the world. Ordinary monads for indexed types give a discipline for effectful programming contingent on state, modelling the whims of fortune in way that Atkey’s indexed monads for ordinary types do not (Atkey, 2009). Arrows in the corresponding Kleisli category represent computations which a reach a given postcondition from a given precondition: their types are just specifications in a Hoare logic! By way of an elementary introduction to this approach, I present the example of a monad for interacting with a file handle which is either ‘open ’ or ‘closed’, constructed from a command interface specfied Hoarestyle. An attempt to open a file results in a state which is statically unpredictable but dynamically detectable. Well typed programs behave accordingly in either case. Haskell’s dependent type system, as exposed by the Strathclyde Haskell Enhancement preprocessor, provides a suitable basis for this simple experiment. 1
Intuitionistic Refinement Calculus An extended version of [Bou07a] examplified on the game of Nim
, 2007
"... Refinement calculi are program logics which formalize the “topdown ” methodology of software development promoted by Dijkstra and Wirth in the early days of structured programming. I present here the shallow embedding of a refinement calculus into Coq constructive type theory. This embedding involv ..."
Abstract
 Add to MetaCart
Refinement calculi are program logics which formalize the “topdown ” methodology of software development promoted by Dijkstra and Wirth in the early days of structured programming. I present here the shallow embedding of a refinement calculus into Coq constructive type theory. This embedding involves monad transformers and the computational reflexion of weakestpreconditions, using a continuation passing style. It should allow to reason about many ML programs combining nonfunctional features (state, exceptions, etc) with purely functional ones (higherorder functions, structural recursion, etc). The interest of combining higherorder functions and imperative state modifications is examplified here on the modelization of the game of Nim. 1
Polymonads
"... From their semantic origins to their use in structuring effectful computations, monads are now also used as a programming pattern to structure code in a number of important scenarios, including for program verification, for information flow tracking, to compute complexity bounds, and for defining pr ..."
Abstract
 Add to MetaCart
From their semantic origins to their use in structuring effectful computations, monads are now also used as a programming pattern to structure code in a number of important scenarios, including for program verification, for information flow tracking, to compute complexity bounds, and for defining precise typeandeffect analyses. However, whilst these examples are inspired by monads they are not strictly speaking monadic but rather something more general. The first contribution of this paper is the definition of a new categorical structure, the polymonad, which explains these notquitemonadic constructions, and subsumes wellknown concepts including monads, layered monads, and systems of monads and monad morphisms, among others. We show how to interpret polymonads in the setting of System Fω. While this interpretaion enables several useful programming idioms, programming directly with polymonads in Fω is far from convenient. Addressing this concern, the second contribution of this paper is core MLlike programming language, λPM, with a polymorphic type inference algorithm that infers a principal polymonadic type for a program and elaborates it to Fω in a coherent way—all unambiguous typing derivations produce elaborated programs with the same semantics. The resulting programming style in λPM is powerful and lightweight, as we demonstrate through a series of examples. 1.