AdvTPL9 - definitions Chapter 9 The Polymorphic Lambda...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 W. Pelz 2003-09 1 Chapter 9 The Polymorphic Lambda Calculus W. Pelz 2003-09 2 definitions • polymorphic functions – functions that operate uniformly on values of different types • parameterized types – functions from types to types, e.g., Stack(T), Array of T • kinds – categorize functions from types to types W. Pelz 2003-09 3 kind p - kind of all types (simplest form) κ ∈ Kind ::= p | κ ⇒ κ p p represents functions from p to p • kind categorizes functions in a manner similar to types that categorize expressions W. Pelz 2003-09 4 classification p - the kind of proper types (like Bool and Bool Bool) p p - the kind of type operators (i.e., functions from proper types to proper types) p p p - the kind of functions from proper types to type operators (i.e., two-argument operators) ( p p ) p - the kind of functions from type operators to proper types “Kinds, then, are ‘the types of types’” W. Pelz 2003-09 5 examples Void and Command have kind p • Pair = λ t.(t × t) has kind p p • AppPair = λ t. λ u.((t × (t u)) u) has kind( p p ) p AppPair(Integer)(Boolean) = ((Integer × (Integer Boolean)) Boolean) W. Pelz 2003-09 6 expressions • divided into three separate classes – terms: basic data values (integer, float), compound data values (record, etc.), value-level abstractions, applications, type abstractions, and type applications – types: proper types (Nat, Nat Nat, Pair Nat Bool) and type operators (Pair, λ X.X X) where Pair = λ t.(t × t) – kinds
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 W. Pelz 2003-09 7 in pictures W. Pelz 2003-09 8 in pictures W. Pelz 2003-09 9 in pictures W. Pelz 2003-09 10 in pictures W. Pelz 2003-09 11 in pictures W. Pelz 2003-09 12 in pictures
Background image of page 2
3 W. Pelz 2003-09 13 homework • What is the difference in meaning between the type-level expressions X.X X and λ X.X X ? • Why doesn’t an arrow type like Nat Nat have an arrow kind like p p ? W. Pelz 2003-09 14 properties • kind is right-associative, i.e., p p p is p ⇒( p p ) • CI is a collection of constructor identifiers • CC is a collection of constructor constants W. Pelz 2003-09 15 type constructor pre-expressions (Defn. 9.1.1) • Let L be an infinite collection of labels, and let CC be a collection of type constants. The type constructor pre-expressions of are given by the following: μ, υ ∈ Constructor ::= v
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/21/2011 for the course CS 542 taught by Professor Dr. thomas during the Spring '10 term at SUNY Buffalo.

Page1 / 7

AdvTPL9 - definitions Chapter 9 The Polymorphic Lambda...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online