An introduction to functional programming. July 23, 2010
|
|
- Gloria Shepherd
- 5 years ago
- Views:
Transcription
1 An introduction to functional programming July 23, 2010 About
2 Outline About About
3 What is functional programming? What is? Why functional programming? Why? is novel. is powerful. is fun. About A brief description of the history of.
4 is a purely functional programming language. Referential transparency. is lazy. Programs as a series of transformations on data. is statically typed. uses a very good type system that has type inference. is elegant and concise. was made by some really smart guys. About
5 About Learning is much like learning to program for the first time it s fun! It forces you to think differently.
6 About Functional programming Functional programming is a style of programming which models computations as the evaluation of expressions. Functional programming means that programs are executed by evaluating expressions. Brevity, ease of understanding, no core dumps. Code reuse, strong glue, powerful abstractions, built-in memory management. Purity (immutable data, referential transparency, lazy evaluation, purity, and side effects). Recursion. About
7 About is an advanced purely functional programming language. It is a polymorphically statically typed, lazy, purely functional programming language. It is an open-source product of more than twenty years of cutting-edge research. It allows rapid development of robust, concise, correct software. With strong support for integration with other languages, built-in concurrency and parallelism, debugger, profilers, rich libraries and an active community, makes it easier to produce flexible, maintainable high-quality software. About
8 About The Glasgow Compiler (GHC) The Glorious Glasgow Compilation System, also known as the Glasgow Compiler (GHC), is a state-of-the-art, open source, compiler and interactive environment for the functional language. GHC has two main components: GHCi is an interactive interpreter and debugger. GHC is an optimizing compiler. About The Glasgow Compiler (GHC).
9 About The Platform The Platform is a comprehensive, robust development environment for programming in. The platform makes it trivial to get up and running with a full development environment. The platform provides a comprehensive, standard base for commercial and open source development that maximises interoperability and stability. The platform is comprehensive, robust, and cutting-edge. About The Platform. The standard development environment.
10 About The community The Communities and Activities Report. in industry. in education. in research. and mathematics. Planet, The Monad.Reader About
11 About Frag About
12 About About
13 Example () 1. ghci> "" "" 2. ghci> putstrln "" 3. ghci> putstr "\n" 4. main :: IO () main = putstrln "" About
14 Factorial Example (Factorial) factorial :: (Integral a) => a -> a 1. factorial n = if n == 0 then 1 else n * factorial (n - 1) 2. factorial n n == 0 = 1 otherwise = n * factorial (n - 1) 3. factorial 0 = 1 factorial n = n * factorial (n - 1) 4. ghci> let factorial n = product [1..n] ghci> factorial About
15 About
16 Basic interaction Examples (Simple arithmetic) 1. ghci> ghci> (*) ghci> Precedence parsing error 4. ghci> :set +t ghci> 19 + (- 88) -69 it :: Integer ghci> :unset +t About
17 Basic interaction Examples (Boolean logic) 1. ghci> True && (False True) True 2. ghci> True && 1 No instance for... Examples (Value comparisons) 1. ghci> (20 / 10) == (2 * 4) False 2. ghci> (2 ^ 3) <= 16 True 3. ghci> not ("Hello" /= "Hello") True About
18 Basic interaction Examples (Precedence and associativity) 1. ghci> (50 * 100) ghci> 50 * ghci> 50 * ( ) ghci> :info (+) class (Eq a, Show a) => Num a where (+) :: a -> a -> a... infixl 6 + About
19 Basic interaction Examples (Undefined values) 1. ghci> pi ghci> e... Not in scope... Example (Introducing variables) About ghci> let e = exp 1 ghci> e
20 Lists Examples (Lists) 1. ghci> ["David","Roger",[]] ["David","Roger",""] 2. ghci> [True,False,"True"] Couldn t match expected type ghci> [1..5] ++ [5,4..1] [1,2,3,4,5,5,4,3,2,1] 4. ghci> [1.0, ] [1.0,1.25,1.5,1.75,2.0] 5. ghci> [ ] [1.0,2.0] About
21 Lists Examples (Operators on lists) 1. ghci> ["David","Roger"] ++ ["Richard"] ["David","Roger","Richard"] 2. ghci> [] ++ [False,True] ++ [True] [False,True,True] 3. ghci> 1:[2,3] [1,2,3] 4. ghci> 1:[] [1] 5. ghci> [1,2]:[] No instance for... About
22 List comprehensions Examples 1. ghci> [x*2 x <- [1..10]] [2,4,6,8,10,12,14,16,18,20] 2. pairs :: [a] -> [b] -> [(a,b)] pairs xs ys = [(x,y) x <- xs, y <- ys] 3. perms :: (Eq a) => [a] -> [[a]] perms [] = [[]] perms xs = [x:ps x <- xs, ps <- perms (xs\\[x])] About
23 Strings and characters Examples (Strings and characters) 1. ghci> "Lost for Words" "Lost for Words" 2. ghci> putstrln "The Division\nBell" The Division Bell 3. ghci> [ A, n, i, m, a, l, s ] "Animals" 4. ghci> "" == [] True 5. ghci> D :("avid" ++ " Gilmour" ++ "") "David Gilmour" About
24 Example Example (LineCount.hs) main :: IO () main = interact linecount where linecount input = show (length (lines input)) ++ "\n" About runghc LineCount < LineCount.hs 4
25 Lazy evaluation Lazy evaluation causes that expressions are not evaluated when they are bound to variables, but their evaluation is deferred until their results are needed by other computations. A lazy evaluator will only evaluate an argument to a function if that argument value is needed to compute the overall result. If an argument is structured (a list or a tuple, for instance), only those parts of the argument which are needed will be examined. About
26 Lazy evaluation Examples (Infinite lists) 1. ones :: [Int] ones = 1 : ones 2. powers :: Int -> [Int] powers n = [n^x x <- [0..]] 3. pythagtriples :: [(Int,Int,Int)] pythagtriples = [(x,y,z) z <- [2..], y <- [2..z - 1], x <- [2..y - 1], x*x + y*y == z*z] About
27 Lazy evaluation Example (The Sieve of Eratosthenes) primes :: [Integer] primes = sieve [2..] sieve :: [Integer] -> [Integer] sieve (x:xs) = x : sieve [y y <- xs, y mod x > 0] memberord :: (Ord a) => [a] -> a -> Bool memberord (x:xs) n x < n = memberord xs n x == n = True otherwise = False About
28 Algebraic types Algebraic data type definitions are introduced by the keyword data, followed by the name of the type, an equals sign and then the constructors of the type being defined. The simplest sort of algebraic type is defined by enumerating the elements of the type. Examples About 1. data Temp = Cold Hot 2. data Season = Spring Summer data Bool = True False
29 Algebraic types About Examples 1. type Name = String type Age = Int data Person = Person Name Age 2. data Shape = Circle Float Rectangle Float Float deriving (Eq,Ord,Show,Read)
30 Pattern matching Example (Numerical expressions) data Expr = Lit Int Add Expr Expr Sub Expr Expr eval :: Expr -> Int eval (Lit n) = n eval (Add e1 e2) = (eval e1) + (eval e2) eval (Sub e1 e2) = (eval e1) - (eval e2) About
31 About
32 Polymorphism A value is polymorphic if, depending on the context where it is used, it can take more than one type. Example (Last) ghci> :type last last :: [a] -> a ghci> last [1,9,8,9] 9 ghci> last "Ummagumma" a About Parametric polymorphism is when a function s type signature allows various arguments to take on arbitrary types, but the types must be related to each other in some way.
33 Polymorphism Ad-hoc polymorphism (or overloading) is when the possible types are limited and must be individually specified before use. Example (Show) ghci> :type show show :: (Show a) => a -> String ghci> show 22 "22" ghci> show 2.2 "2.2" About In, ad-hoc polymorphism is achieved by type classes.
34 Higher order functions A higher order function is a function that takes other functions as arguments or returns a function as result. Example (Map) ghci> :type map map :: (a -> b) -> [a] -> [b] ghci> map (*2) [1..5] [2,4,6,8,10] About Functions as arguments and functions as values. Partial function application and currying. Anonymous (lambda) functions....
35 1. Understanding the problem. 2. Designing the program. 3. Writing the program. 4. Looking back. Simon Thompson. Where do I begin? A problem solving approach in teaching functional programming. About
36 Example (The maximum of three integers) 1. Understanding the problem. maxthree :: Int -> Int -> Int -> Int 2. Designing and writing the program. maxtwo :: Int -> Int -> Int maxtwo a b a <= b = b otherwise = a maxthree a b c b <= a && c <= a = a a <= b && c <= b = b otherwise = c maxthree a b c = maxtwo (maxtwo a b) c 3. Looking back. About
37 Learn you a for great good! About
38 Learn you a for great good! 1. Read chapters 1-6 of the tutorial Learn You a for Great Good! 2. Answer the following questions. What do you like/dislike about functional programming? What do you like/dislike about? What do you think of the tutorial?... About Miran Lipovača. Learn You a for Great Good!
39 Real world 1. Read chapters 1-4 of the book Real World. 2. Answer the following questions. What do you like/dislike about functional programming? What do you like/dislike about? What do you think of the book?... Bryan O Sullivan, Don Stewart, and John Goerzen. Real World. O Reilly Media, About
40 and functional programming. Thinking in. A change in perspective. Learning. The standard libraries. The community. Outlook Modules, classes, input and output, higher order functions, testing, monads, data structures, libraries.... About
41 Bryan O Sullivan, Don Stewart, and John Goerzen. Real World. O Reilly Media, Simon Thompson. : The Craft of Functional Programming. Addison-Wesley, Miran Lipovača. Learn You a for Great Good! About
Practical Haskell. An introduction to functional programming. July 21, Practical Haskell. Juan Pedro Villa-Isaza. Introduction.
Practical Practical An introduction to functional programming July 21, 2011 Contents Practical Practical is fun, and that s what it s all about! Even if seems strange to you at first, don t give up. Learning
More informationHaskell 101. (Version 1 (July 18, 2012)) Juan Pedro Villa Isaza
Haskell 101 (Version 1 (July 18, 2012)) Juan Pedro Villa Isaza Haskell 101: Contents Introduction Tutorial Homework Bibliography Haskell 101: Contents Introduction Tutorial Homework Bibliography Haskell
More informationIntroduction to Haskell
Introduction to Haskell Matt Mullins Texas A&M Computing Society October 6, 2009 Matt Mullins (TACS) Introduction to Haskell October 6, 2009 1 / 39 Outline Introduction to Haskell Functional Programming
More informationProgramming Languages Fall 2013
Programming Languages Fall 2013 Lecture 2: types Prof. Liang Huang huang@qc.cs.cuny.edu Recap of Lecture 1 functional programming vs. imperative programming basic Haskell syntax function definition lazy
More informationCS 11 Haskell track: lecture 1
CS 11 Haskell track: lecture 1 This week: Introduction/motivation/pep talk Basics of Haskell Prerequisite Knowledge of basic functional programming e.g. Scheme, Ocaml, Erlang CS 1, CS 4 "permission of
More informationHaske k ll An introduction to Functional functional programming using Haskell Purely Lazy Example: QuickSort in Java Example: QuickSort in Haskell
Haskell An introduction to functional programming using Haskell Anders Møller amoeller@cs.au.dk The most popular purely functional, lazy programming language Functional programming language : a program
More informationAn introduction introduction to functional functional programming programming using usin Haskell
An introduction to functional programming using Haskell Anders Møller amoeller@cs.au.dkau Haskell The most popular p purely functional, lazy programming g language Functional programming language : a program
More informationProgramming Paradigms
PP 2017/18 Unit 11 Functional Programming with Haskell 1/37 Programming Paradigms Unit 11 Functional Programming with Haskell J. Gamper Free University of Bozen-Bolzano Faculty of Computer Science IDSE
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 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 informationCSC312 Principles of Programming Languages : Functional Programming Language. Copyright 2006 The McGraw-Hill Companies, Inc.
CSC312 Principles of Programming Languages : Functional Programming Language Overview of Functional Languages They emerged in the 1960 s with Lisp Functional programming mirrors mathematical functions:
More informationAccording to Larry Wall (designer of PERL): a language by geniuses! for geniuses. Lecture 7: Haskell. Haskell 98. Haskell (cont) - Type-safe!
Lecture 7: Haskell CSC 131 Fall, 2014 Kim Bruce According to Larry Wall (designer of PERL): a language by geniuses for geniuses He s wrong at least about the latter part though you might agree when we
More informationHaskell: From Basic to Advanced. Part 2 Type Classes, Laziness, IO, Modules
Haskell: From Basic to Advanced Part 2 Type Classes, Laziness, IO, Modules Qualified types In the types schemes we have seen, the type variables were universally quantified, e.g. ++ :: [a] -> [a] -> [a]
More informationAbstract Types, Algebraic Types, and Type Classes
Informatics 1 Functional Programming Lectures 13 and 14 Monday 9 and Tuesday 10 November 2009 Abstract Types, Algebraic Types, and Type Classes Philip Wadler University of Edinburgh Reminders Tutorial
More informationCS 360: Programming Languages Lecture 10: Introduction to Haskell
CS 360: Programming Languages Lecture 10: Introduction to Haskell Geoffrey Mainland Drexel University Thursday, February 5, 2015 Adapted from Brent Yorgey s course Introduction to Haskell. Section 1 Administrivia
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 informationHaskell in the corporate environment. Jeff Polakow October 17, 2008
Haskell in the corporate environment Jeff Polakow October 17, 2008 Talk Overview Haskell and functional programming System description Haskell in the corporate environment Functional Programming in Industry
More informationFunctional Programming in Haskell Part I : Basics
Functional Programming in Haskell Part I : Basics Madhavan Mukund Chennai Mathematical Institute 92 G N Chetty Rd, Chennai 600 017, India madhavan@cmi.ac.in http://www.cmi.ac.in/ madhavan Madras Christian
More informationHaskell Types, Classes, and Functions, Currying, and Polymorphism
1 CSCE 314: Programming Languages Dr. Flemming Andersen Haskell Types, Classes, and Functions, Currying, and Polymorphism 2 Types A type is a collection of related values. For example, Bool contains the
More informationInformatics 1 Functional Programming Lectures 13 and 14 Monday 11 and Tuesday 12 November Type Classes. Don Sannella University of Edinburgh
Informatics 1 Functional Programming Lectures 13 and 14 Monday 11 and Tuesday 12 November 2013 Type Classes Don Sannella University of Edinburgh Mock exam Slots and rooms have now been assigned Mon 18
More informationAdvanced Topics in Programming Languages Lecture 2 - Introduction to Haskell
Advanced Topics in Programming Languages Lecture 2 - Introduction to Haskell Ori Bar El Maxim Finkel 01/11/17 1 History Haskell is a lazy, committee designed, pure functional programming language that
More informationINTRODUCTION TO FUNCTIONAL PROGRAMMING
INTRODUCTION TO FUNCTIONAL PROGRAMMING Graham Hutton University of Nottingham adapted by Gordon Uszkay 1 What is Functional Programming? Opinions differ, and it is difficult to give a precise definition,
More informationAdvanced features of Functional Programming (Haskell)
Advanced features of Functional Programming (Haskell) Polymorphism and overloading January 10, 2017 Monomorphic and polymorphic types A (data) type specifies a set of values. Examples: Bool: the type of
More informationA general introduction to Functional Programming using Haskell
A general introduction to Functional Programming using Haskell Matteo Rossi Dipartimento di Elettronica e Informazione Politecnico di Milano rossi@elet.polimi.it 1 Functional programming in a nutshell
More informationCSc 372. Comparative Programming Languages. 8 : Haskell Function Examples. Department of Computer Science University of Arizona
1/43 CSc 372 Comparative Programming Languages 8 : Haskell Function Examples Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2013 Christian Collberg Functions over Lists
More informationCSci 450: Org. of Programming Languages Overloading and Type Classes
CSci 450: Org. of Programming Languages Overloading and Type Classes H. Conrad Cunningham 27 October 2017 (after class) Contents 9 Overloading and Type Classes 1 9.1 Chapter Introduction.........................
More information3. Functional Programming. Oscar Nierstrasz
3. Functional Programming Oscar Nierstrasz Roadmap > Functional vs. Imperative Programming > Pattern Matching > Referential Transparency > Lazy Evaluation > Recursion > Higher Order and Curried Functions
More informationFUNCTIONAL PROGRAMMING 1 HASKELL BASICS
1 FUNCTIONAL PROGRAMMING 1 HASKELL BASICS Dr. Ahmed Sallam Reference 2 Main: Introduction to Haskell Further By Brent Yorgey Functional Programming 3 Function is the atom of the language, and can be used
More informationFunctional Programming in Haskell Part 2 : Abstract dataypes and infinite structures
Functional Programming in Haskell Part 2 : Abstract dataypes and infinite structures Madhavan Mukund Chennai Mathematical Institute 92 G N Chetty Rd, Chennai 600 017, India madhavan@cmi.ac.in http://www.cmi.ac.in/
More informationPrinciples of Programming Languages
Principles of Programming Languages h"p://www.di.unipi.it/~andrea/dida2ca/plp- 14/ Prof. Andrea Corradini Department of Computer Science, Pisa Introduc;on to Hakell Lesson 27! 1 The origins: ML programming
More informationCSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Haskell Functions
1 CSCE 314: Programming Languages Dr. Flemming Andersen Haskell Functions 2 Outline Defining Functions List Comprehensions Recursion 3 Conditional Expressions As in most programming languages, functions
More informationCS 360: Programming Languages Lecture 12: More Haskell
CS 360: Programming Languages Lecture 12: More Haskell Geoffrey Mainland Drexel University Adapted from Brent Yorgey s course Introduction to Haskell. Section 1 Administrivia Administrivia Homework 5 due
More informationHaskell Introduction Lists Other Structures Data Structures. Haskell Introduction. Mark Snyder
Outline 1 2 3 4 What is Haskell? Haskell is a functional programming language. Characteristics functional non-strict ( lazy ) pure (no side effects*) strongly statically typed available compiled and interpreted
More informationCSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Haskell Basics
1 CSCE 314: Programming Languages Dr. Flemming Andersen Haskell Basics 2 Contents 1. Jump into Haskell: Using ghc and ghci (more detail) 2. Historical Background of Haskell 3. Lazy, Pure, and Functional
More informationPROGRAMMING IN HASKELL. Chapter 5 - List Comprehensions
PROGRAMMING IN HASKELL Chapter 5 - List Comprehensions 0 Set Comprehensions In mathematics, the comprehension notation can be used to construct new sets from old sets. {x 2 x {1...5}} The set {1,4,9,16,25}
More informationOverview. Declarative Languages D7012E. Overloading. Overloading Polymorphism Subtyping
Overview Declarative Languages D7012E Lecture 4: The Haskell type system Fredrik Bengtsson / Johan Nordlander Overloading & polymorphism Type classes instances of type classes derived type classes Type
More informationIntroduction. chapter Functions
chapter 1 Introduction In this chapter we set the stage for the rest of the book. We start by reviewing the notion of a function, then introduce the concept of functional programming, summarise the main
More informationFirst Haskell Exercises
First Haskell Exercises CS110 November 23, 2016 Although it is possible to install Haskell on your computer, we want to get started quickly, so we will be using an online Haskell programming system (also
More informationHaskell through HUGS THE BASICS
Haskell through HUGS THE BASICS FP for DB Basic HUGS 1 Algorithmic Imperative Languages variables assignment if condition then action1 else action2 loop block while condition do action repeat action until
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 informationFunctional Programming and Haskell
Functional Programming and Haskell Tim Dawborn University of Sydney, Australia School of Information Technologies Tim Dawborn Functional Programming and Haskell 1/22 What are Programming Paradigms? A programming
More informationFunctional Programming
Functional Programming Overview! Functional vs. imperative programming! Fundamental concepts! Evaluation strategies! Pattern matching! Higher order functions! Lazy lists References! Richard Bird, Introduction
More informationLecture 19: Functions, Types and Data Structures in Haskell
The University of North Carolina at Chapel Hill Spring 2002 Lecture 19: Functions, Types and Data Structures in Haskell Feb 25 1 Functions Functions are the most important kind of value in functional programming
More informationFunctional Programming. Big Picture. Design of Programming Languages
Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics
More informationInformatics 1 Functional Programming 19 Tuesday 23 November IO and Monads. Philip Wadler University of Edinburgh
Informatics 1 Functional Programming 19 Tuesday 23 November 2010 IO and Monads Philip Wadler University of Edinburgh The 2010 Informatics 1 Competition Sponsored by Galois (galois.com) List everyone who
More informationLogic - CM0845 Introduction to Haskell
Logic - CM0845 Introduction to Haskell Diego Alejandro Montoya-Zapata EAFIT University Semester 2016-1 Diego Alejandro Montoya-Zapata (EAFIT University) Logic - CM0845 Introduction to Haskell Semester
More informationCSc 372 Comparative Programming Languages
CSc 372 Comparative Programming Languages 8 : Haskell Function Examples Christian Collberg collberg+372@gmail.com Department of Computer Science University of Arizona Copyright c 2005 Christian Collberg
More informationImperative languages
Imperative languages Von Neumann model: store with addressable locations machine code: effect achieved by changing contents of store locations instructions executed in sequence, flow of control altered
More informationCSCE 314 Programming Languages
CSCE 314 Programming Languages Haskell 101 Dr. Hyunyoung Lee 1 Contents 1. Historical Background of Haskell 2. Lazy, Pure, and Functional Language 3. Using ghc and ghci 4. Functions 5. Haskell Scripts
More informationOverloading, Type Classes, and Algebraic Datatypes
Overloading, Type Classes, and Algebraic Datatypes Delivered by Michael Pellauer Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. September 28, 2006 September 28, 2006 http://www.csg.csail.mit.edu/6.827
More informationInformatics 1 Functional Programming Lecture 9. Algebraic Data Types. Don Sannella University of Edinburgh
Informatics 1 Functional Programming Lecture 9 Algebraic Data Types Don Sannella University of Edinburgh Part I Algebraic types Everything is an algebraic type data Bool = False True data Season = Winter
More informationIntroduction to Functional Programming in Haskell 1 / 56
Introduction to Functional Programming in Haskell 1 / 56 Outline Why learn functional programming? The essence of functional programming What is a function? Equational reasoning First-order vs. higher-order
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 informationProgramming Paradigms
PP 2017/18 Unit 12 Functions and Data Types in Haskell 1/45 Programming Paradigms Unit 12 Functions and Data Types in Haskell J. Gamper Free University of Bozen-Bolzano Faculty of Computer Science IDSE
More informationProgramming in Haskell Aug-Nov 2015
Programming in Haskell Aug-Nov 2015 LECTURE 14 OCTOBER 1, 2015 S P SURESH CHENNAI MATHEMATICAL INSTITUTE Enumerated data types The data keyword is used to define new types data Bool = False True data Day
More informationCS 320: Concepts of Programming Languages
CS 320: Concepts of Programming Languages Wayne Snyder Computer Science Department Boston University Lecture 08: Type Classes o o Review: What is a type class? Basic Type Classes: Eq, Ord, Enum, Integral,
More informationAdvances in Programming Languages
T O Y H Advances in Programming Languages APL8: Multiparameter Type Classes, Constructor Classes Ian Stark School of Informatics The University of Edinburgh Thursday 4 February Semester 2 Week 4 E H U
More informationLittle and not so big bits of Haskell
Little and not so big bits of Haskell D. Renault Haskell (small) School LaBRI October 2015, v. 1.2.1 D. Renault (LaBRI) Little and not so big bits of Haskell October 2015, v. 1.2.1 1 / 45 1990 - A committee
More informationFunctional Programming for Logicians - Lecture 1
Functional Programming for Logicians - Lecture 1 Functions, Lists, Types Malvin Gattinger 4 June 2018 module L1 where Introduction Who is who Course website: https://malv.in/2018/funcproglog/ Malvin Gattinger
More informationReferences. Monadic I/O in Haskell. Digression, continued. Digression: Creating stand-alone Haskell Programs
References Monadic I/O in Haskell Jim Royer CIS 352 March 6, 2018 Chapter 18 of Haskell: the Craft of Functional Programming by Simon Thompson, Addison-Wesley, 2011. Chapter 9 of Learn you a Haskell for
More informationParallel Haskell on MultiCores and Clusters
Parallel Haskell on MultiCores and Clusters (part of Advanced Development Techniques) Hans-Wolfgang Loidl School of Mathematical and Computer Sciences Heriot-Watt University, Edinburgh (presented at the
More informationAlgebraic Types. Chapter 14 of Thompson
Algebraic Types Chapter 14 of Thompson Types so far Base types Int, Integer, Float, Bool, Char Composite types: tuples (t 1,t 2,,t n ) lists [t 1 ] functions (t 1 -> t 2 ) Algebraic types enumerated, product
More informationIntroduction to ML. Mooly Sagiv. Cornell CS 3110 Data Structures and Functional Programming
Introduction to ML Mooly Sagiv Cornell CS 3110 Data Structures and Functional Programming The ML Programming Language General purpose programming language designed by Robin Milner in 1970 Meta Language
More informationFunctional Programming
Functional Programming Björn B. Brandenburg The University of North Carolina at Chapel Hill Based in part on slides and notes by S. Olivier, A. Block, N. Fisher, F. Hernandez-Campos, and D. Stotts. Brief
More informationChapter 15. Functional Programming Languages
Chapter 15 Functional Programming Languages Copyright 2009 Addison-Wesley. All rights reserved. 1-2 Chapter 15 Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages
More informationSimon Peyton Jones Microsoft Research August 2012
Simon Peyton Jones Microsoft Research August 2012 A functional language Purely functional Lazy Statically typed Designed 1988-1990 By a committee For research, teaching, and practical use Geeks Practitioners
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 informationCOP4020 Programming Languages. Functional Programming Prof. Robert van Engelen
COP4020 Programming Languages Functional Programming Prof. Robert van Engelen Overview What is functional programming? Historical origins of functional programming Functional programming today Concepts
More informationMonad Background (3A) Young Won Lim 11/18/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 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 informationPROGRAMMING IN HASKELL. Chapter 2 - First Steps
PROGRAMMING IN HASKELL Chapter 2 - First Steps 0 The Hugs System Hugs is an implementation of Haskell 98, and is the most widely used Haskell system; The interactive nature of Hugs makes it well suited
More informationChapter 15. Functional Programming. Topics. Currying. Currying: example. Currying: example. Reduction
Topics Chapter 15 Functional Programming Reduction and Currying Recursive definitions Local definitions Type Systems Strict typing Polymorphism Classes Booleans Characters Enumerations Tuples Strings 2
More informationHaskell: From Basic to Advanced. Haskell buzzwords. Hello, World! History. Haskell 98 / Haskell 2010 GHC
Haskell: From Basic to Advanced Haskell buzzwords Part 1 Basic Language Functional Pure Lazy Strong static typing Type polymorphism Type classes Monads Haskell 98 / Haskell 2010 GHC Glasgow Haskell Compiler
More informationCPS 506 Comparative Programming Languages. Programming Language Paradigm
CPS 506 Comparative Programming Languages Functional Programming Language Paradigm Topics Introduction Mathematical Functions Fundamentals of Functional Programming Languages The First Functional Programming
More informationMonad Background (3A) Young Won Lim 11/8/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 informationD7020E. The dynamic evolution of a system Robust and Energy-Efficient Real-Time Systems. blocked Lecture 2: Components & the Timber language.
Recall The dynamic evolution of a system Robust and Energy-Efficient Real-Time Systems with offset asynchronous calls synchronous call T T blocked Lecture 2: Components & the Timber language buffered??
More informationD7020E. Robust and Energy-Efficient Real-Time Systems D7020E. Lecture 2: Components & the Timber language
Robust and Energy-Efficient Real-Time Systems Lecture 2: Components & the Timber language 1 1 Recall The dynamic evolution of a system... with offset asynchronous calls synchronous call T T blocked buffered
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 informationLecture 8: Summary of Haskell course + Type Level Programming
Lecture 8: Summary of Haskell course + Type Level Programming Søren Haagerup Department of Mathematics and Computer Science University of Southern Denmark, Odense October 31, 2017 Principles from Haskell
More informationIntroduction to ML. Mooly Sagiv. Cornell CS 3110 Data Structures and Functional Programming
Introduction to ML Mooly Sagiv Cornell CS 3110 Data Structures and Functional Programming The ML Programming Language General purpose programming language designed by Robin Milner in 1970 Meta Language
More informationCS457/557 Functional Languages
CS457/557 Functional Languages Spring 2018 Lecture 1: Course Introduction Andrew Tolmach Portland State University (with thanks to Mark P. Jones) 1 Goals of this course Introduce the beautiful ideas of
More information301AA - Advanced Programming [AP-2017]
301AA - Advanced Programming [AP-2017] Lecturer: Andrea Corradini andrea@di.unipi.it Tutor: Lillo GalleBa galleba@di.unipi.it Department of Computer Science, Pisa Academic Year 2017/18 AP-2017-15: Func'onal
More informationFunctional Programming in Haskell for A level teachers
Functional Programming in Haskell for A level teachers About this document Functional Programming is now part of the A level curriculum. This document is intended to get those who already have some programming
More informationCSE 3302 Programming Languages Lecture 8: Functional Programming
CSE 3302 Programming Languages Lecture 8: Functional Programming (based on the slides by Tim Sheard) Leonidas Fegaras University of Texas at Arlington CSE 3302 L8 Spring 2011 1 Functional Programming Languages
More informationFunctional Programming I *** Functional Programming and Interactive Theorem Proving. Ulrich Berger Michaelmas Term 2006
Functional Programming I *** Functional Programming and Interactive Theorem Proving Ulrich Berger Michaelmas Term 2006 2 *** Room 306 (Faraday Tower) Phone 513380 Fax 295708 u.berger@swansea.ac.uk http://www-compsci.swan.ac.uk/
More informationFunctional Logic Programming Language Curry
Functional Logic Programming Language Curry Xiang Yin Department of Computer Science McMaster University November 9, 2010 Outline Functional Logic Programming Language 1 Functional Logic Programming Language
More information02157 Functional Programming. Michael R. Ha. Lecture 2: Functions, Types and Lists. Michael R. Hansen
Lecture 2: Functions, Types and Lists nsen 1 DTU Compute, Technical University of Denmark Lecture 2: Functions, Types and Lists MRH 13/09/2018 Outline Functions as first-class citizens Types, polymorphism
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 informationCSCE 314 Programming Languages
CSCE 314 Programming Languages Final Review Part I Dr. Hyunyoung Lee 1 Programming Language Characteristics Different approaches to describe computations, to instruct computing devices E.g., Imperative,
More informationIntroduction to Functional Programming and Haskell. Aden Seaman
Introduction to Functional Programming and Haskell Aden Seaman Functional Programming Functional Programming First Class Functions Expressions (No Assignment) (Ideally) No Side Effects Different Approach
More informationLazy Functional Programming in Haskell
Lazy Functional Programming in Haskell David Raymond Christiansen 25 November, 2013 What is Haskell? 2 What is Haskell? Pure functional language: no side effects 2 What is Haskell? Pure functional language:
More informationFunctional Programming
Functional Programming Søren Haagerup Department of Mathematics and Computer Science University of Southern Denmark, Odense September 5, 2017 Practical Information The course is split in two I am responsible
More informationSolution sheet 1. Introduction. Exercise 1 - Types of values. Exercise 2 - Constructors
Solution sheet 1 Introduction Please note that there can be other solutions than those listed in this document. This is a literate Haskell file which is available as PDF, as well as literate Haskell source
More informationTesting. Wouter Swierstra and Alejandro Serrano. Advanced functional programming - Lecture 2. [Faculty of Science Information and Computing Sciences]
Testing Advanced functional programming - Lecture 2 Wouter Swierstra and Alejandro Serrano 1 Program Correctness 2 Testing and correctness When is a program correct? 3 Testing and correctness When is a
More informationJVM ByteCode Interpreter
JVM ByteCode Interpreter written in Haskell (In under 1000 Lines of Code) By Louis Jenkins Presentation Schedule ( 15 Minutes) Discuss and Run the Virtual Machine first
More informationCSCI-GA Scripting Languages
CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation
More informationHaskell: Lists. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Friday, February 24, Glenn G.
Haskell: Lists CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Friday, February 24, 2017 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks
More informationSML A F unctional Functional Language Language Lecture 19
SML A Functional Language Lecture 19 Introduction to SML SML is a functional programming language and acronym for Standard d Meta Language. SML has basic data objects as expressions, functions and list
More informationInformatics 1 Functional Programming Lectures 15 and 16. IO and Monads. Don Sannella University of Edinburgh
Informatics 1 Functional Programming Lectures 15 and 16 IO and Monads Don Sannella University of Edinburgh Part I The Mind-Body Problem The Mind-Body Problem Part II Commands Print a character putchar
More information2 Haskell. Haskell (629) 59. Haskell. B. Curry. 1.2, 1.3, Haskell 98 [16] 1. Haskell. Haskell. ( Haskell.
(629) 59 Haskell 1 Haskell Haskell Hugs GHC 2 Haskell 2.1 Haskell 1987 FPCA (Functional Programming Languages and Computer Architechture) Programming Language Haskell and Systems Yoshiyuki ONOUE,, Graduate
More information