CSE583: Programming Languages

1/25/00


Click here to start


Table of Contents

CSE583: Programming Languages

Functional programming: 2+ weeks

Tonight: a final set of topics on functional languages

Then, with luck, on to types

ML concrete user-defined datatypes

Example

Variant records/tagged unions

Example

Using datatypes

Recursive user-defined datatypes

But what about a polymorphic version?

Polymorphic binary trees

That’s a mouthful: use a wrapper

A problem

In ML it doesn’t work

Use exceptions

Handling exceptions

Exceptions can have arguments

Streams

Streams in ML

Basic functions

References

Examples

Modules

Note

Overview

Structures

Accessing members

Signatures

Example

Holes in encapsulation

Another hole

Aside: abstract/concrete data

Functors

Example

Example con’t

Signature “subtyping”

In ML

Limitations in ML

Modules vs. ADTs in ML

Haskell

A bit of history

A few quick, minor examples

List comprehensions

quicksort

Easy to construct arithmetic sequences

Sections

Lazy vs. eager evaluation

Example

Streams in Haskell

Examples

Lazy programming paradigm

Polymorphic functions

Bounded polymorphism

More

Subtype constraints

Type classes in Haskell

Example

Instances of type classes

Type classes as polymorphic constraints

Defining contexts

Conditional instances

Default implementations in type classes

Type subclasses

Hierarchy of predefined type classes in Haskell

Type classes vs. OO subtypes

Type classes vs. ML polymorphism

Whew

Author: David Notkin

Email: notkin@cs.washington.edu

Home Page: http://www.cs.washington.edu/education/courses/583

Download presentation source