Skip to content

Latest commit

 

History

History

L2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Lecture 2: (Embedded) Domain Specific Languages

Lecture slides

Below is just a "table of contents" for the lecture.

Learning outcomes for L2

This lecture we will focus on the following subset of the full AFP course learning outcomes:

  • DSL: design embedded domain specific languages
    • DSL.Concepts: (abstract) syntax, semantics, ...
    • DSL.Implement: implement EDSLs in Haskell (as combinator libraries)
  • Types: read, understand and extend Haskell programs which use advanced type system features
    • Types.Class: type classes, newtypes, deriving, ...
  • Expl: explain and discuss the above topics

Anatomy of an EDSL

Primitive and derived operations

Think about: Compositionality, Abstraction

Implementation of an EDSL

Shallow embedding of Signals

Deep embedding of Signals

Deep versus Shallow

Case Study: A language for Shapes, v1

A language for Shapes, v2

More on the interfaces

Side track: A matrix library

Shallow embedding

Shallow embedding, continued

Deep embedding

Deep embedding, without GADT for reference

Deep embedding, cont.

Abstraction!

More interesting run function: render as ASCII-art

Connect back to to Signals

Discussion

Summary

  • Different kinds of operations
    • constructor functions, combinators, run functions
  • Implementation styles
    • Shallow: representation given by the semantics
    • Deep: representation given by the syntax
  • Remember
    • Compositionality
    • Abstraction