A more elegant specification for FRP
|
|
- Alaina Bates
- 5 years ago
- Views:
Transcription
1 A more elegant specification for FRP Conal Elliott LambdaJam 2015 Conal Elliott A more elegant specification for FRP LambdaJam / 20
2 The story so far Conal Elliott A more elegant specification for FRP LambdaJam / 20
3 FRP s two fundamental properties Precise, simple denotation. (Elegant & rigorous.) Continuous time. (Natural & composable.) FRP is not about: Conal Elliott A more elegant specification for FRP LambdaJam / 20
4 FRP s two fundamental properties Precise, simple denotation. (Elegant & rigorous.) Continuous time. (Natural & composable.) FRP is not about: graphs, updates and propagation, streams, doing Conal Elliott A more elegant specification for FRP LambdaJam / 20
5 Semantics Central abstract type: Behavior a a flow of values. Conal Elliott A more elegant specification for FRP LambdaJam / 20
6 Semantics Central abstract type: Behavior a a flow of values. Precise & simple semantics: µ :: Behavior a Ñ pt Ñ aq where T R (reals). Conal Elliott A more elegant specification for FRP LambdaJam / 20
7 Semantics Central abstract type: Behavior a a flow of values. Precise & simple semantics: µ :: Behavior a Ñ pt Ñ aq where T R (reals). Much of API and its specification can follow from this one choice. Conal Elliott A more elegant specification for FRP LambdaJam / 20
8 Original formulation Conal Elliott A more elegant specification for FRP LambdaJam / 20
9 API time :: Behavior T lift 0 :: a Ñ Behavior a lift 1 :: pa Ñ bq Ñ Behavior a Ñ Behavior b lift 2 :: pa Ñ b Ñ cq Ñ Behavior a Ñ Behavior b Ñ Behavior c timetrans :: Behavior a Ñ Behavior T Ñ Behavior a integral :: VS a ñ Behavior a Ñ T Ñ Behavior a... instance Num a ñ Num pbehavior aq where Reactivity later. Conal Elliott A more elegant specification for FRP LambdaJam / 20
10 Semantics µ time λt Ñ t µ plift 0 aq λt Ñ a µ plift 1 f xsq λt Ñ f pµ xs tq µ plift 2 f xs ysq λt Ñ f pµ xs tq pµ ys tq µ ptimetrans xs ttq λt Ñ µ xs pµ tt tq instance Num a ñ Num pbehavior aq where frominteger lift 0 frominteger p`q lift 2 p`q... Conal Elliott A more elegant specification for FRP LambdaJam / 20
11 Semantics µ time id µ plift 0 aq const a µ plift 1 f xsq f µ xs µ plift 2 f xs ysq lifta 2 f pµ xsq pµ ysq µ ptimetrans xs ttq µ xs µ tt instance Num a ñ Num pbehavior aq where frominteger lift 0 frominteger p`q lift 2 p`q... Conal Elliott A more elegant specification for FRP LambdaJam / 20
12 Events Secondary type: µ :: Event a Ñ rpt, aqs -- non-decreasing times never :: Event a once :: T Ñ a Ñ Event a p..q :: Event a Ñ Event a Ñ Event a pùñq :: Event a Ñ pa Ñ bq Ñ Event b predicate :: Behavior Bool Ñ Event pq snapshot :: Event a Ñ Behavior b Ñ Event pa, bq Exercise: define semantics of these operations. Conal Elliott A more elegant specification for FRP LambdaJam / 20
13 A more elegant specification Conal Elliott A more elegant specification for FRP LambdaJam / 20
14 API Replace several operations with standard abstractions: instance Functor Behavior where... instance Applicative Behavior where... instance Monoid a ñ Monoid pbehavior aq where... Why? instance Functor Event where... instance Monoid a ñ Monoid pevent aq where... Conal Elliott A more elegant specification for FRP LambdaJam / 20
15 API Replace several operations with standard abstractions: instance Functor Behavior where... instance Applicative Behavior where... instance Monoid a ñ Monoid pbehavior aq where... instance Functor Event where... instance Monoid a ñ Monoid pevent aq where... Why? Less learning, more leverage. Specifications and laws for free. Conal Elliott A more elegant specification for FRP LambdaJam / 20
16 Semantic instances instance Functor ppñq z q where... instance Applicative ppñq z q where... instance Monoid a ñ Monoid pz Ñ aq where... instance Num a ñ Num pz Ñ aq where The Behavior instances follow in precise analogy to denotation. Conal Elliott A more elegant specification for FRP LambdaJam / 20
17 Homomorphisms A homomorphism h is a function that preserves (distributes over) an algebraic structure. For instance, for Monoid: h ε ε h pas bsq h as h bs Conal Elliott A more elegant specification for FRP LambdaJam / 20
18 Homomorphisms A homomorphism h is a function that preserves (distributes over) an algebraic structure. For instance, for Monoid: h ε ε h pas bsq h as h bs Some monoid homomorphisms: length 1 :: ra s Ñ Sum Int length 1 Sum length log 1 :: Product R Ñ Sum R log 1 Sum log getproduct Conal Elliott A more elegant specification for FRP LambdaJam / 20
19 More homomorphism properties Functor: h pfmap f xsq fmap f ph xsq Applicative: h ppure aq pure a h pfs ă ą xsq h fs ă ą h xs Monad: h pm ą kq h m ą h k Conal Elliott A more elegant specification for FRP LambdaJam / 20
20 Specification by semantic homomorphism Specification: µ as homomorphism. For instance, µ pfmap f asq fmap f pµ asq µ ppure aq pure a µ pfs ă ą xsq µ fs ă ą µ xs Conal Elliott A more elegant specification for FRP LambdaJam / 20
21 Semantic instances instance Monoid a ñ Monoid pz Ñ aq where ε λz Ñ ε f g λz Ñ f z g z instance Functor ppñq z q where fmap g f g f instance Applicative ppñq z q where pure a λz Ñ a ff ă ą fx λz Ñ pff zq pfx zq Conal Elliott A more elegant specification for FRP LambdaJam / 20
22 Semantic homomorphisms Put the pieces together: µ ppure aq pure a µ pfs ă ą xsq µ fs ă ą µ xs λt Ñ a λt Ñ pµ fs tq pµ xs tq Likewise for Functor, Monoid, Num, etc. Conal Elliott A more elegant specification for FRP LambdaJam / 20
23 Semantic homomorphisms Put the pieces together: µ ppure aq pure a µ pfs ă ą xsq µ fs ă ą µ xs λt Ñ a λt Ñ pµ fs tq pµ xs tq Likewise for Functor, Monoid, Num, etc. Notes: Corresponds exactly to the original FRP denotation. Follows inevitably from semantic homomorphism principle. Laws hold for free (already paid for). Conal Elliott A more elegant specification for FRP LambdaJam / 20
24 Laws for free µ ε ε µ pa bq µ a µ b ñ a ε a ε b b a pb cq pa bq c where equality is semantic. Conal Elliott A more elegant specification for FRP LambdaJam / 20
25 Laws for free µ ε ε µ pa bq µ a µ b ñ a ε a ε b b a pb cq pa bq c where equality is semantic. Proofs: µ pa εq µ a µ ε µ a ε µ a µ pε bq µ ε µ b ε µ b µ b µ pa pb cqq µ a pµ b µ cq pµ a µ bq µ c µ ppa bq cq Works for other classes as well. Conal Elliott A more elegant specification for FRP LambdaJam / 20
26 Events newtype Event a Event pbehavior ra sq deriving pmonoid, Functor q -- discretely non-empty Conal Elliott A more elegant specification for FRP LambdaJam / 20
27 Events newtype Event a Event pbehavior ra sq deriving pmonoid, Functor q -- discretely non-empty Derived instances: instance Monoid a ñ Monoid pevent aq where ε Event ppure εq Event u Event v Event plifta 2 p q u vq instance Functor Event where fmap f pevent bq Event pfmap pfmap f q bq Conal Elliott A more elegant specification for FRP LambdaJam / 20
28 Events newtype Event a Event pbehavior ra sq deriving pmonoid, Functor q -- discretely non-empty Derived instances: instance Monoid a ñ Monoid pevent aq where ε Event ppure εq Event u Event v Event plifta 2 p q u vq instance Functor Event where fmap f pevent bq Event pfmap pfmap f q bq Alternatively, type Event Behavior r s Conal Elliott A more elegant specification for FRP LambdaJam / 20
29 Conclusion Two fundamental properties: Precise, simple denotation. (Elegant & rigorous.) Continuous time. (Natural & composable.) Warning: most recent FRP systems lack both. Conal Elliott A more elegant specification for FRP LambdaJam / 20
30 Conclusion Two fundamental properties: Precise, simple denotation. (Elegant & rigorous.) Continuous time. (Natural & composable.) Warning: most recent FRP systems lack both. Semantic homomorphisms: Mine semantic model for API. Inevitable API semantics (minimize invention). Laws hold for free (already paid for). No abstraction leaks. Matches original FRP semantics. Generally useful principle for library design. Conal Elliott A more elegant specification for FRP LambdaJam / 20
Denotational Design. from meanings to programs. Conal Elliott. LambdaJam Conal Elliott Denotational Design LambdaJam / 58
Denotational Design from meanings to programs Conal Elliott LambdaJam 2015 Conal Elliott Denotational Design LambdaJam 2015 1 / 58 Abstraction The purpose of abstraction is not to be vague, but to create
More informationCompiling to categories
Compiling to categories Conal Elliott Target, USA September 2017 Conal Elliott (Target, USA) Compiling to categories September 2017 1 / 28 Overloading Alternative interpretation of common vocabulary. Laws
More informationWhat is reactive programming. Basic Concepts of Reactivity. Behaviours. Functional Reactive Programming
What is reactive programming Jacek Malec Dept. of Computer Science, Lund University, Sweden May 22nd, 2017 Lecture based on: http://www.haskell.org/haskellwiki/functional_ Reactive_Programming 2008 lecture
More informationApplicative, traversable, foldable
Applicative, traversable, foldable Advanced functional programming - Lecture 3 Wouter Swierstra 1 Beyond the monad So far, we have seen how monads define a common abstraction over many programming patterns.
More informationApplicative, traversable, foldable
Applicative, traversable, foldable Advanced functional programming - Lecture 4 Wouter Swierstra and Alejandro Serrano 1 Beyond the monad So far, we have seen how monads define a common abstraction over
More informationApplicatives Comparisons (2C) Young Won Lim 3/6/18
Comparisons (2C) Copyright (c) 2016-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later
More informationCS 173 Lecture 18: Relations on a Set
CS 173 Lecture 18: Relations on a Set José Meseguer University of Illinois at Urbana-Champaign 1 Relations on a Set 1.1 The Data Type RelpAq Many algorithms, in particular the so-called graph algorithms,
More informationProbabilistic systems a place where categories meet probability
Probabilistic systems a place where categories meet probability Ana Sokolova SOS group, Radboud University Nijmegen University Dortmund, CS Kolloquium, 12.6.6 p.1/32 Outline Introduction - probabilistic
More informationMonad Overview (3B) Young Won Lim 1/16/18
Based on Haskell in 5 steps https://wiki.haskell.org/haskell_in_5_steps 2 Copyright (c) 2016-2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of
More informationComposable Semantics for Language Synthesis
Composable Semantics for Language Synthesis Boyan Beronov, Chris Chen CPSC 509: Programming Language Principles University of British Columbia, Vancouver November 19, 2018 Motivation What we wish, that
More informationCSCE 314 Programming Languages Functors, Applicatives, and Monads
CSCE 314 Programming Languages Functors, Applicatives, and Monads Dr. Hyunyoung Lee 1 Motivation Generic Functions A common programming pattern can be abstracted out as a definition. For example: inc ::
More informationProgramming with Math and Logic
.. Programming with Math and Logic an invitation to functional programming Ed Morehouse Wesleyan University The Plan why fp? terms types interfaces The What and Why of Functional Programming Computing
More informationCollege Functors, Applicatives
College 2016-2017 Functors, Applicatives Wouter Swierstra with a bit of Jurriaan Hage Utrecht University Contents So far, we have seen monads define a common abstraction over many programming patterns.
More informationBackground Type Classes (1B) Young Won Lim 6/28/18
Background Type Classes (1B) Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2
More informationBackground Type Classes (1B) Young Won Lim 6/14/18
Background Type Classes (1B) Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2
More informationLecture 4: Higher Order Functions
Lecture 4: Higher Order Functions Søren Haagerup Department of Mathematics and Computer Science University of Southern Denmark, Odense September 26, 2017 HIGHER ORDER FUNCTIONS The order of a function
More information1 Delimited continuations in Haskell
1 Delimited continuations in Haskell This section describes programming with delimited control in Haskell. Delimited control, like its instance, exceptions, is an effect. Therefore, we have to use monads.
More informationMonads and all that III Applicative Functors. John Hughes Chalmers University/Quviq AB
Monads and all that III Applicative Functors John Hughes Chalmers University/Quviq AB Recall our expression parser expr = do a
More informationThe essence of dataflow programming. Teooriapäevad Kokel 2,
The essence of dataflow programming Tarmo UUSTALU Varmo VENE Teooriapäevad Kokel 2, 4.-6.2.2005 Motivation Following Moggi and Wadler, it is standard in programming and semantics to analyze various notions
More informationType system. Type theory. Haskell type system. EDAN40: Functional Programming Types and Type Classes (revisited)
Type system EDAN40: Functional Programming Types and Type Classes (revisited) Jacek Malec Dept. of Computer Science, Lund University, Sweden April 3rd, 2017 In programming languages, a type system is a
More informationCategory Theory. Roger Jones. Abstract. Formalisation of some of the concepts of category theory in ProofPower-HOL. Created 2006/04/09
Category Theory Roger Jones Abstract Formalisation of some of the concepts of category theory in ProofPower-HOL. Created 2006/04/09 Last Changed Date: 20/08/5 7:00:38 http://www.rbjones.com/rbjpub/pp/doc/t07.pdf
More informationFunctional programming and parallelism
Functional programming and parallelism Conal Elliott May 216 What makes a language good for parallelism?... Conal Elliott Functional programming and parallelism May 216 2 / 61 What makes a language bad
More informationColecture 1: Algebras, algebraic data types, and recursion
Colecture 1: Algebras, algebraic data types, and recursion Aleks Kissinger (and Juriaan Rot) ovember 15, 2016 1 Turning arrows around A common past-time of category theories is to double their research
More informationThe Algebra of Programming in Haskell
The Algebra of Programming in Haskell Bruno Oliveira The Algebra of Programming in Haskell p.1/21 Datatype Generic Programming - Motivation/Goals The project is to develop a novel mechanism for parameterizing
More informationLivin la via loca Coercing Types with Class
Livin la via loca Coercing Types with Class Baldur Blöndal Ryan Scott 1 Andres Löh 2 1 Indiana University 2 Well-Typed LLP rgscott@indiana.edu github.com/ryanglscott Glasgow Haskell Compiler (or, GHC)
More informationHaskell Type Constraints Unleashed
Haskell Type Constraints Unleashed Dominic Orchard University of Cambridge Tom Schrijvers KU Leuven Fun in the Afternoon, Standard Chartered. February 17, 2010 C τ Type classestype classes Data types Type
More informationApplicative Data-Driven Computation
DRAFT Comments please Applicative Data-Driven Computation Conal Elliott LambdaPix conal@conal.net Abstract Graphical user interfaces (GUIs) are usually programmed in an unnatural style, in that implementation
More informationAll About Comonads (Part 1) An incomprehensible guide to the theory and practice of comonadic programming in Haskell
All About Comonads (Part 1) An incomprehensible guide to the theory and practice of comonadic programming in Haskell Edward Kmett http://comonad.com/ Categories Categories have objects and arrows Every
More informationSimply efficient functional reactivity
LambdaPix technical report 2008-01, April 2008; revised 2008-11-18 1 Simply efficient functional reactivity Conal Elliott LambdaPix conal@conal.net Abstract Functional reactive programming (FRP) has simple
More informationMaybe Monad (3B) Young Won Lim 1/3/18
Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published
More informationAdvanced Programming Handout 7. Monads and Friends (SOE Chapter 18)
Advanced Programming Handout 7 Monads and Friends (SOE Chapter 18) The Type of a Type In previous chapters we discussed: Monomorphic types such as Int, Bool, etc. Polymorphic types such as [a], Tree a,
More informationLast time: generic programming
1/ 55 Last time: generic programming val (=) : { D: DATA } D. t D. t bool 2/ 55 This time: monads etc., continued >>= effect E 3/ 55 Recap: monads, bind and let An imperative program let id =! counter
More informationCSC324 Principles of Programming Languages
CSC324 Principles of Programming Languages http://mcs.utm.utoronto.ca/~324 November 21, 2018 Last Class Types terminology Haskell s type system Currying Defining types Value constructors Algebraic data
More informationHigh-performance defunctionalization in Futhark
1 High-performance defunctionalization in Futhark Anders Kiel Hovgaard Troels Henriksen Martin Elsman Department of Computer Science University of Copenhagen (DIKU) Trends in Functional Programming, 2018
More informationPolymorphism Overview (1A) Young Won Lim 2/20/18
Polymorphism Overview (1A) Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2
More informationHaskell Overloading (1) LiU-FP2016: Lecture 8 Type Classes. Haskell Overloading (3) Haskell Overloading (2)
Haskell Overloading (1) LiU-FP2016: Lecture 8 Type Classes Henrik Nilsson University of Nottingham, UK What is the type of (==)? E.g. the following both work: 1 == 2 a == b I.e., (==) can be used to compare
More informationDerivingVia or, How to Turn Hand-Written Instances into an Anti-Pattern
DerivingVia or, How to Turn Hand-Written Instances into an Anti-Pattern Baldur Blöndal Ryan Scott 1 Andres Löh 2 1 Indiana University 2 Well-Typed LLP rgscott@indiana.edu github.com/ryanglscott A brief
More informationUser-Defined Algebraic Data Types
72 Static Semantics User-Defined Types User-Defined Algebraic Data Types An algebraic data type declaration has the general form: data cx T α 1... α k = K 1 τ 11... τ 1k1... K n τ n1... τ nkn introduces
More informationAdvanced Functional Programming
Advanced Functional Programming Tim Sheard Portland State University Lecture 2: More about Type Classes Implementing Type Classes Higher Order Types Multi-parameter Type Classes Tim Sheard 1 Implementing
More informationGraphical Models & HMMs
Graphical Models & HMMs Henrik I. Christensen Robotics & Intelligent Machines @ GT Georgia Institute of Technology, Atlanta, GA 30332-0280 hic@cc.gatech.edu Henrik I. Christensen (RIM@GT) Graphical Models
More informationDerivingVia or, How to Turn Hand-Written Instances into an Anti-Pattern
1 DerivingVia or, How to Turn Hand-Written Instances into an Anti-Pattern Baldur Blöndal Andres Löh 1 Ryan Scott 2 1 Well-Typed LLP 2 Indiana University Haskell Symposium 2018 St. Louis, MO newtype Pair
More informationExtending Monads with Pattern Matching
Extending Monads with Pattern Matching Tomas Petricek Alan Mycroft University of Cambridge {tomas.petricek, am}@cl.cam.ac.uk Don Syme Microsoft Research Cambridge don.syme@microsoft.com Abstract Sequencing
More informationMonad class. Example: Lambda laughter. The functional IO problem. EDAN40: Functional Programming Functors and Monads
Monad class EDAN40: Functional Programming Functors and Monads Jacek Malec Dept. of Computer Science, Lund University, Sweden April 23rd, 2018 Motivation: Separation of pure and impure code Properties
More informationIntroduction to Recursion schemes
Introduction to Recursion schemes Lambda Jam 2018-05-22 Amy Wong BRICKX amy@brickx.com Agenda My background Problem in recursion Fix point concept Recursion patterns, aka morphisms Using morphisms to solve
More informationCSCE 314 Programming Languages
CSCE 314 Programming Languages Haskell: Higher-order Functions Dr. Hyunyoung Lee 1 Higher-order Functions A function is called higher-order if it takes a function as an argument or returns a function as
More informationShell CSCE 314 TAMU. Higher Order Functions
1 CSCE 314: Programming Languages Dr. Dylan Shell Higher Order Functions 2 Higher-order Functions A function is called higher-order if it takes a function as an argument or returns a function as a result.
More informationMonad (1A) Young Won Lim 6/26/17
Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published
More informationHarvard School of Engineering and Applied Sciences CS 152: Programming Languages
Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 18 Thursday, March 29, 2018 In abstract algebra, algebraic structures are defined by a set of elements and operations
More informationHaskell & functional programming, some slightly more advanced stuff. Matteo Pradella
Haskell & functional programming, some slightly more advanced stuff Matteo Pradella pradella@elet.polimi.it IEIIT, Consiglio Nazionale delle Ricerche & DEI, Politecnico di Milano PhD course @ UniMi - Feb
More informationContinuation Passing Style. Continuation Passing Style
161 162 Agenda functional programming recap problem: regular expression matcher continuation passing style (CPS) movie regular expression matcher based on CPS correctness proof, verification change of
More informationTypes in Programming Languages Dynamic and Static Typing, Type Inference (CTM 2.8.3, EPL* 4) Abstract Data Types (CTM 3.7) Monads (GIH** 9)
Types in Programming Languages Dynamic and Static Typing, Type Inference (CTM 2.8.3, EPL* 4) Abstract Data Types (CTM 3.7) Monads (GIH** 9) Carlos Varela Rensselaer Polytechnic Institute September 23,
More informationParsing. Zhenjiang Hu. May 31, June 7, June 14, All Right Reserved. National Institute of Informatics
National Institute of Informatics May 31, June 7, June 14, 2010 All Right Reserved. Outline I 1 Parser Type 2 Monad Parser Monad 3 Derived Primitives 4 5 6 Outline Parser Type 1 Parser Type 2 3 4 5 6 What
More informationDiscrete Mathematics Lecture 4. Harper Langston New York University
Discrete Mathematics Lecture 4 Harper Langston New York University Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2,, a n, Each individual element a k is called a
More informationINTRODUCTION TO HASKELL
INTRODUCTION TO HASKELL PRINCIPLES OF PROGRAMMING LANGUAGES Norbert Zeh Winter 2018 Dalhousie University 1/81 HASKELL: A PURELY FUNCTIONAL PROGRAMMING LANGUAGE Functions are first-class values: Can be
More informationProfunctor Optics: Modular Data Accessors
Profunctor Optics: Modular Data Accessors Jeremy Gibbons (joint work with Matthew Pickering and Nicolas Wu) Spring Festival Workshop, Karuizawa, March 2017 Profunctor Optics 2 1. Overview lenses for access
More informationMokhov A. Algebraic Graphs with Class (functional pearl). In: Haskell Symposium 2017 (
Mokhov A. Algebraic Graphs with Class (functional pearl). In: Haskell Symposium 017 (part of Proceedings of the 10th ACM SIGPLAN International Symposium on Haskell). 017, Oxford: ACM. Copyright: Author
More informationMonads in Haskell. Nathanael Schilling. December 12, 2014
Monads in Haskell Nathanael Schilling December 12, 2014 Abstract In Haskell, monads provide a mechanism for mapping functions of the type a -> m b to those of the type m a -> m b. This mapping is dependent
More informationPropositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson Propositional Calculus Objective: To provide students with the concepts and techniques from propositional calculus
More informationCSC Discrete Math I, Spring Sets
CSC 125 - Discrete Math I, Spring 2017 Sets Sets A set is well-defined, unordered collection of objects The objects in a set are called the elements, or members, of the set A set is said to contain its
More informationZipping Search Trees. Tom Schrijvers. with Denoit Desouter and Bart Demoen
Zipping Search Trees Tom Schrijvers with Denoit Desouter and Bart Demoen Motivation 2 Earlier Work 3 Earlier Work Monadic Constraint Programming T. S., P. Stuckey, P. Wadler. (JFP 09) Haskell 3 Earlier
More informationMaybe Monad (3B) Young Won Lim 12/21/17
Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published
More informationCategory Theory & Functional Data Abstraction
Category Theory & Functional Data Abstraction Brandon Shapiro Math 100b 1. Introduction Throughout mathematics, particularly algebra, there are numerous commonalities between the studies of various objects
More informationInterleaving data and effects
Under consideration for publication in J. Functional Programming 1 Interleaving data and effects ROBERT ATKEY University of Strathclyde PATRICIA JOHANN Appalachian State University (e-mail: robert.atkey@strath.ac.uk,
More informationThe Formal Semantics of Programming Languages An Introduction. Glynn Winskel. The MIT Press Cambridge, Massachusetts London, England
The Formal Semantics of Programming Languages An Introduction Glynn Winskel The MIT Press Cambridge, Massachusetts London, England Series foreword Preface xiii xv 1 Basic set theory 1 1.1 Logical notation
More informationInformation Science 1
Information Science Boolean Expressions Week College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 9 l Binary (Boolean) logic History Boolean
More informationQuickCheck: Beyond the Basics
QuickCheck: Beyond the Basics Dave Laing May 13, 2014 Basic QuickCheck Some properties reverse_involutive :: [Int] -> Bool reverse_involutive xs = xs == (reverse. reverse) xs sort_idempotent :: [Int] ->
More informationHaskell An Introduction
Haskell An Introduction What is Haskell? General purpose Purely functional No function can have side-effects IO is done using special types Lazy Strongly typed Polymorphic types Concise and elegant A First
More informationFizzBuzz in Haskell by Embedding a Domain-Specific Language
FizzBuzz in Haskell by Embedding a Domain-Specific Language by Maciej Piróg maciej.adam.pirog@gmail.com April 23, 2014 The FizzBuzz problem is simple but not trivial, which makes it a popular puzzle during
More informationMonad (3A) Young Won Lim 8/9/17
Copyright (c) 2016-2017 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published
More informationModeling User Interfaces in a Functional Language. Antony Courtney. Zhong Shao Conal Elliott
Modeling User Interfaces in a Functional Language Antony Courtney Advisor: Committee: Acknowledgement: Paul Hudak John Peterson Zhong Shao Conal Elliott Henrik Nilsson Thesis Thesis: Functional Reactive
More informationn n Try tutorial on front page to get started! n spring13/ n Stack Overflow!
Announcements n Rainbow grades: HW1-6, Quiz1-5, Exam1 n Still grading: HW7, Quiz6, Exam2 Intro to Haskell n HW8 due today n HW9, Haskell, out tonight, due Nov. 16 th n Individual assignment n Start early!
More informationLecture Notes: Control Flow Analysis for Functional Languages
Lecture Notes: Control Flow Analysis for Functional Languages 17-355/17-665: Program Analysis (Spring 2017) Jonathan Aldrich aldrich@cs.cmu.edu 1 Analysis of Functional Programs Analyzing functional programs
More informationFUNCTIONAL PROGRAMMING NO.9 TYPE AND CLASS. Tatsuya Hagino
1 FUNCTIONAL PROGRAMMING NO.9 TYPE AND CLASS Tatsuya Hagino hagino@sfc.keio.ac.jp 2 Static Type Checking and Type Inference Type a set of values Bool = { True, False } Char = { 'a', 'b',... } Int = {...
More informationFrom monoids to near-semirings: the essence of MonadPlus and Alternative
From monoids to near-semirings: the essence of MonadPlus and Alternative Exequiel Rivas Mauro Jaskelioff CIFASIS-CONICET Universidad Nacional de Rosario, Argentina jaskelioff@cifasis-conicet.gov.ar rivas@cifasis-conicet.gov.ar
More informationCSE-321 Programming Languages 2012 Midterm
Name: Hemos ID: CSE-321 Programming Languages 2012 Midterm Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 14 15 29 20 7 15 100 There are six problems on 24 pages in this exam. The maximum score
More informationMonads. Functional Programming (CS4011) Monads
Monads Functional Programming (CS4011) Andrew Butterfield Glenn Strong Foundations & Methods Group, Discipline of Software Systems Trinity College, University of Dublin {Andrew.Butterfield,Glenn.Strong}@cs.tcd.ie
More informationHaskell Monads CSC 131. Kim Bruce
Haskell Monads CSC 131 Kim Bruce Monads The ontological essence of a monad is its irreducible simplicity. Unlike atoms, monads possess no material or spatial character. They also differ from atoms by their
More informationAlgebra of Logic Programming Silvija Seres Michael Spivey Tony Hoare Oxford University Computing Laboratory Wolfson Building, Parks Road, Oxford OX1 3
Algebra of Logic Programming Silvija Seres Michael Spivey Tony Hoare Oxford University Computing Laboratory Wolfson Building, Parks Road, Oxford OX1 3QD, U.K. Abstract A declarative programming language
More informationIdris: Implementing a Dependently Typed Programming Language
Idris: Implementing a Dependently Typed Programming Language Edwin Brady University of St Andrews ecb10@st-andrews.ac.uk @edwinbrady Type Inference and Automated Proving, Dundee, 12th May 2015 1 / 25 Idris
More informationMonads. Bonus lecture 2017 David Sands
Monads Bonus lecture 2017 David Sands Our version of the story, so far. Monad is the class of instructions. Instructions can be built using do notation. We have seen two kinds of instructions i.e. two
More informationMonads. Prof. Clarkson Fall Today s music: Vámanos Pal Monte by Eddie Palmieri
Monads Prof. Clarkson Fall 2017 Today s music: Vámanos Pal Monte by Eddie Palmieri Review Currently in 3110: Advanced topics Futures: Async: deferreds, return, bind Today: Monads Monad tutorials since
More informationGeneric Programming with Adjunctions
Generic Programming with Adjunctions 0.0 Generic Programming with Adjunctions Ralf Hinze Computing Laboratory, University of Oxford Wolfson Building, Parks Road, Oxford, OX1 3QD, England ralf.hinze@comlab.ox.ac.uk
More informationThe Arrow Calculus (Functional Pearl)
The Arrow Calculus (Functional Pearl) Sam Lindley Philip Wadler Jeremy Yallop University of Edinburgh Abstract We introduce the arrow calculus, a metalanguage for manipulating Hughes s arrows with close
More informationThe language of categories
The language of categories Mariusz Wodzicki March 15, 2011 1 Universal constructions 1.1 Initial and inal objects 1.1.1 Initial objects An object i of a category C is said to be initial if for any object
More informationCIS 194: Homework 6. Due Wednesday, 4 March. Fibonacci numbers. It s all about being lazy.
CIS 194: Homework 6 Due Wednesday, 4 March It s all about being lazy. Fibonacci numbers The Fibonacci numbers F n are defined as the sequence of integers, beginning with 1 and 1, where every integer in
More informationSoftware Properties as Axioms and Theorems
Applied Software Properties as Axioms and Theorems proofs by induction or How to Write Reliable Software and know it's reliable Applied 1 Example: Multiplexor Function Problem: Multiplex two sequences
More informationComputing data with spreadsheets Example: Computing triangular numbers and their square roots. Recall, we showed 1 ` 2 ` ` n npn ` 1q{2.
Computing data with spreadsheets Example: Computing triangular numbers and their square roots. Recall, we showed 1 ` 2 ` ` n npn ` 1q{2. Computing data with spreadsheets Example: Computing triangular numbers
More informationCourse year Typeclasses and their instances
Course year 2016-2017 Typeclasses and their instances Doaitse Swierstra and Atze Dijkstra with extra s Utrecht University September 29, 2016 1. The basics 2 Overloading versus parametric polymorphism 1
More informationPart I Logic programming paradigm
Part I Logic programming paradigm 1 Logic programming and pure Prolog 1.1 Introduction 3 1.2 Syntax 4 1.3 The meaning of a program 7 1.4 Computing with equations 9 1.5 Prolog: the first steps 15 1.6 Two
More informationCSE-321 Programming Languages 2010 Midterm
Name: Hemos ID: CSE-321 Programming Languages 2010 Midterm Score Prob 1 Prob 2 Prob 3 Prob 4 Total Max 15 30 35 20 100 1 1 SML Programming [15 pts] Question 1. [5 pts] Give a tail recursive implementation
More informationSets. Mukulika Ghosh. Fall Based on slides by Dr. Hyunyoung Lee
Sets Mukulika Ghosh Fall 2018 Based on slides by Dr. Hyunyoung Lee Sets Sets A set is an unordered collection of objects, called elements, without duplication. We write a A to denote that a is an element
More informationType-Safe Observable Sharing in Haskell
Type-Safe Observable Sharing in Haskell Andy Gill The University of Kansas September 3, 2009 Andy Gill (The University of Kansas) Type-Safe Observable Sharing in Haskell September 3, 2009 1 / 27 Domain
More information1. Function Type Declarations (12 points):
1. Function Type Declarations (12 points): For each of the following function definitions, correctly complete the preceding type declaration. Be sure to include any necessary class constraints. (A) mystery1
More informationLecture Notes: Widening Operators and Collecting Semantics
Lecture Notes: Widening Operators and Collecting Semantics 15-819O: Program Analysis (Spring 2016) Claire Le Goues clegoues@cs.cmu.edu 1 A Collecting Semantics for Reaching Definitions The approach to
More informationTrees. Solution: type TreeF a t = BinF t a t LeafF 1 point for the right kind; 1 point per constructor.
Trees 1. Consider the following data type Tree and consider an example inhabitant tree: data Tree a = Bin (Tree a) a (Tree a) Leaf deriving Show tree :: Tree Int tree = Bin (Bin (Bin Leaf 1 Leaf ) 2 (Bin
More informationMonads seen so far: IO vs Gen
Monads David Sands Monads seen so far: IO vs Gen IO A Gen A Instructions to build a value of type A by interacting with the operating system Instructions to create a random value of type A Run by the ghc
More informationMonads. COS 441 Slides 16
Monads COS 441 Slides 16 Last time: Agenda We looked at implementation strategies for languages with errors, with printing and with storage We introduced the concept of a monad, which involves 3 things:
More informationCompile-Time Code Generation for Embedded Data-Intensive Query Languages
Compile-Time Code Generation for Embedded Data-Intensive Query Languages Leonidas Fegaras University of Texas at Arlington http://lambda.uta.edu/ Outline Emerging DISC (Data-Intensive Scalable Computing)
More informationCS 321 Programming Languages
CS 321 Programming Languages Intro to OCaml Lists Baris Aktemur Özyeğin University Last update made on Monday 2 nd October, 2017 at 19:27. Some of the contents here are taken from Elsa Gunter and Sam Kamin
More informationProgram Calculus Calculational Programming
Program Calculus Calculational Programming National Institute of Informatics June 21 / June 28 / July 5, 2010 Program Calculus Calculational Programming What we will learn? Discussing the mathematical
More information