SLIDE 14 Introduction
Problem Towards a solution
Generic Views
Detour into GH The influence of views Formal definition Validity
Implementation in Generic Haskell
Generic Haskell Adding a view
Conclusions
7
GH Basics
A generic function in Generic Haskell
◮ Is type-indexed ◮ Just like in LIGD, slightly different syntax
An example GH generic function
1 c o l l e c t <Unit>
Unit = [ ]
2 c o l l e c t <a+b> ( I n l
x ) = c o l l e c t <a> x
3 c o l l e c t <a+b> ( I n r
y ) = c o l l e c t <b> y
4 c o l l e c t <a × b> ( x × y ) = c o l l e c t <a> x ++ c o l l e c t <b> y 5 c o l l e c t <Int >
n = [ ]
6 c o l l e c t <Char>
c = [ ]
Type signature
1 c o l l e c t <a : : ∗ | c ::∗ >
: : ( c o l l e c t <a | c>) ⇒ a → [ c ]