Subtyping and Computational Monads Bachelor Thesis - PowerPoint PPT Presentation

About This Presentation
Title:

Subtyping and Computational Monads Bachelor Thesis

Description:

basic properties (e.g. Preservation, Progress) must be proved again. Example: I/O-operations ' ... t ::= x| ?x:T.t | tt. With I/O: s ? * (output alphabet) t : ... – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 17
Provided by: die576
Category:

less

Transcript and Presenter's Notes

Title: Subtyping and Computational Monads Bachelor Thesis


1
Subtyping and Computational MonadsBachelor
Thesis
  • Introduction Talk
  • Dieter Brunotte
  • Advisor Jan Schwinghammer

2
Computational Monads
  • Programming languages have effects (exceptions,
    I/O-operations, divergence)
  • pure lambda calculus add effects in ad-hoc
    manner
  • -gt have new typing/reduction rules
  • -gt basic properties (e.g. Preservation, Progress)
    must be proved again

3
Example I/O-operations
  • pure lambda-calculus
  • t x ?xT.t tt
  • With I/O
  • s ? ? (output alphabet)
  • t print s
  • New typing rules

4
Example I/O-operations (2)
  • New evaluation rules (add outputstring to terms)
  • Example
  • Nondeterministic evaluation with different
    effects

5
Example 2 side-effects
  • New type constructor ref with new typing rules
  • New constants/operations
  • For evaluation add starage

6
Computational Monads
  • Monadic types distinguishes between pure terms
    and effectful computations
  • Unrestricted ß/?-reductions
  • Effect synchronisation by let-construction

7
Moggis calculus
8
New typing rules for monads
9
Reduction
  • Simulates application (?x.e) e for monads
  • requires full evaluation of argument to monadic
    value

10
Example 1 I/O with Monads
  • Intuitively T A ? x A
  • e outputs e, returns e
  • Let x lt e in e
  • Concatenates all output of e with output of
    exe
  • Print s output s, return

11
Example 1 I/O with Monads
  • effects on reduction rules

12
Example 1 I/O with Monads
  • Top level reduction of monadic calculus

13
Example 2side-effects
  • Observe Ø otherwise
  • Top level reduction of monadic calculus

14
Subtyping
  • Allow to use term of type A where type B is
    expected iff A lt B (A subtype of B)
  • Subtype rules
  • example functions (contravariance)

15
Subtyping and Monadic Types
  • Which subtype rule holds for monad
  • Soundness proof of Moggis calculus with Subtyping
    (Preservation,Progress)

16
References
  • Eugenio Moggi. Notions of computation and monads.
    Information and Computation, 93,55-92, 1991.
  • Nick Benton John Hughes Eugenio Moggi. Monads
    and effects. Pages 42-122 of Advanced lectures
    from int. summer school on applied semantics.
    LNCS vol. 2395, Springer, 2002.
  • Benjamin Pierce. Types and Programming Languages.
    MIT Press, 2002.
  • Philip Wadler and Peter Thiemann. The marriage of
    effects and monads .ACM Transactions on
    Computational Logic,1(4),1-32,2003.
Write a Comment
User Comments (0)
About PowerShow.com