Dan Johnson.  Functional language that started development in 1987.  Committee designed language  Pure and Lazy  Compiled or Interpreted  Named after.

Slides:



Advertisements
Similar presentations
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 14 Functional Programming It is better to.
Advertisements

Intro to Scala Lists. Scala Lists are always immutable. This means that a list in Scala, once created, will remain the same.
Introduction to Compilation of Functional Languages Wanhe Zhang Computing and Software Department McMaster University 16 th, March, 2004.
1 Scheme and Functional Programming Aaron Bloomfield CS 415 Fall 2005.
CMSC 330: Organization of Programming Languages Tuples, Types, Conditionals and Recursion or “How many different OCaml topics can we cover in a single.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 7: User-Defined Functions II.
Type Checking.
ALGOL 60 Design by committee of computer scientists: Naur, Backus, Bauer, McCarthy, van Wijngaarden, Landin, etc. Design by committee of computer scientists:
Chapter 15 Other Functional Languages. Copyright © 2007 Addison-Wesley. All rights reserved. Functional Languages Scheme and LISP have a simple syntax.
PPL Syntax & Formal Semantics Lecture Notes: Chapter 2.
Functional Programming Element of Functional Programming.
0 PROGRAMMING IN HASKELL Typeclasses and higher order functions Based on lecture notes by Graham Hutton The book “Learn You a Haskell for Great Good” (and.
0 PROGRAMMING IN HASKELL An Introduction Based on lecture notes by Graham Hutton The book “Learn You a Haskell for Great Good” (and a few other sources)
Functional Programing Referencing material from Programming Language Pragmatics – Third Edition – by Michael L. Scott Andy Balaam (Youtube.com/user/ajbalaam)
Haskell. 2 GHC and HUGS Haskell 98 is the current version of Haskell GHC (Glasgow Haskell Compiler, version 7.4.1) is the version of Haskell I am using.
0 REVIEW OF HASKELL A lightening tour in 45 minutes.
© Kenneth C. Louden, Chapter 11 - Functional Programming, Part III: Theory Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
1 COMP313A Functional Programming (1). 2 Main Differences with Imperative Languages Say more about what is computed as opposed to how Pure functional.
Patterns in OCaml functions. Formal vs. actual parameters Here's a function definition (in C): –int add (int x, int y) { return x + y; } –x and y are.
0 PROGRAMMING IN HASKELL Some first steps Based on lecture notes by Graham Hutton The book “Learn You a Haskell for Great Good” (and a few other sources)
CSC 580 – Theory of Programming Languages, Spring, 2009 Week 9: Functional Languages ML and Haskell, Dr. Dale E. Parson.
Chapter 9: Functional Programming in a Typed Language.
Functional Programming With examples in F#. Pure Functional Programming Functional programming involves evaluating expressions rather than executing commands.
Chapter Fifteen: Functional Programming Languages Lesson 12.
Prog. techniques. Standard prog. techniques Complex programs can be broken down into simpler parts called “Modules” These come in 2 types,“Procedures”
© Kenneth C. Louden, Chapter 11 - Functional Programming, Part III: Theory Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
Simple Classes. ADTs A specification for a real world data item –defines types and valid ranges –defines valid operations on the data. Specification is.
1 Haskell Kevin Atkinson John Simmons. 2 Contents Introduction Type System Variables Functions Module System I/O Conclusions.
1 FP Foundations, Scheme In Text: Chapter Chapter 14: FP Foundations, Scheme Mathematical Functions Def: A mathematical function is a mapping of.
0 PROGRAMMING IN HASKELL Chapter 2 - First Steps.
An introduction to functional programming using Haskell CENG242 –Recitation 1.
1 PROGRAMMING IN HASKELL Lecture 2 Based on lecture notes by Graham Hutton The book “Learn You a Haskell for Great Good” (and a few other sources)
24-Jun-16 Haskell Dealing with impurity. Purity Haskell is a “pure” functional programming language Functions have no side effects Input/output is a side.
1 PROGRAMMING IN HASKELL An Introduction Based on lecture notes by Graham Hutton The book “Learn You a Haskell for Great Good” (and a few other sources)
Functional Programming
Functional Programming
Functional Programming Languages
CS 550 Programming Languages Jeremy Johnson
Midterm recap Total was 80 points Distribution range
CS 3304 Comparative Languages
PROGRAMMING IN HASKELL
Types CSCE 314 Spring 2016.
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
PROGRAMMING IN HASKELL
CS 326 Programming Languages, Concepts and Implementation
A lightening tour in 45 minutes
More Functional Programming
PROGRAMMING IN HASKELL
Haskell.
PROGRAMMING IN HASKELL
Introduction to Functional Programming in Racket
Important Concepts from Clojure
Important Concepts from Clojure
Functional Programming
Haskell Dealing with impurity 30-Nov-18.
FP Foundations, Scheme In Text: Chapter 14.
Type & Typeclass Syntax in function
Haskell Types, Classes, and Functions, Currying, and Polymorphism
Chapter 7: User-Defined Functions II
Introduction to Functional Programming in Racket
Important Concepts from Clojure
Haskell Dealing with impurity 8-Apr-19.
CSE S. Tanimoto Lambda Calculus
PROGRAMMING IN HASKELL
Haskell Dealing with impurity 29-May-19.
PROGRAMMING IN HASKELL
PROGRAMMING IN HASKELL
PROGRAMMING IN HASKELL
Haskell Dealing with impurity 28-Jun-19.
Presentation transcript:

Dan Johnson

 Functional language that started development in  Committee designed language  Pure and Lazy  Compiled or Interpreted  Named after Haskell Curry (who has nothing to do with the language itself)

 It should be suitable for teaching, research, and applications, including building large systems.  It should be completely described via the publication of a formal syntax and semantics.  It should be freely available.  It should be usable as a basis for further language research.  It should be based on ideas that enjoy a wide consensus.  It should reduce unnecessary diversity in functional programming languages.

 Contains a large number of functions for basic operations and list manipulation.  Loaded automatically when ghci is started

 Everything is considered to be “of a type”.  A functions type is determined by its return type.  The :: literally means “is of the type”.  Groups of similar types are classified into Typeclasses.

 Type Inference  Haskell will evaluate the parameters to this function and determine that...  Generally considered bad practice to rely on type inference

 Lists function the same way as in Racket.  Tuples are fixed length types that can contain multiple elements of different types.  By combining lists and tuples, you can create complex and powerful data structures

 Two parts: declaration and definition  Line 34 uses type variables to make the function polymorphic.  Line 35 uses some of the list functions built into prelude

 Two ways to pass multiple parameters to a function:  By using a tuple as the parameter  By defining the function as a curried function  Most multi-parameter functions are curried functions

 Any function that returns a function as its result or accepts a function as a parameter  All curried functions are Higher Order functions because their return type is technically a function

 Any function that uses type variables (and only type variables) is considered to be a polymorphic function.  Polymorphic functions are easy to create  Type inference automatically defines polymorphic types when applicable.  Allow for one function to cover a broad range of types  Most functions in the Prelude are polymorphic functions

If.. Then.. Guards  Syntactically similar to most languages  No “else if” statement, must be done with nested ifs  Written more as a mathematician would write a case structure  More readable, less code to write

 Is at the core of Haskell because it is so prevalent in mathematics  Simply recall the function with different parameters in the function

 Expressions are only evaluated as much as required to produce the final result.  What does this mean?  Why is it important?  Where can we use it?

 Pure languages are said to e languages without side effects  What is a side effect?  Is a pure language even possible?  What are the benefits of purity?  What are the cons of purity?