Home

About

Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network
FAQHELPSITE MAPCONTACT US


  Advanced Search  

 
Sized (Co)Inductive Types With Applications to Generic Programming
 

Summary: Sized (Co­)Inductive Types
With Applications to Generic Programming
Andreas Abel
ProgLog Seminar, April 5, 2006
1 Example: Generic Finite Maps
Finite Maps for List­shaped Keys
. Key type: [a], value type: v
data MapList f v
= Leaf
| Node (Maybe v) (f (MapList f v))
. If f w # = a # fin w, then MapList f v # = [a] # fin v.
. Looking up a list­shaped key:
lookupList :: (forall w. a ­> f w ­> Maybe w) ­>
[a] ­> MapList f v ­> Maybe v
lookupList lo l Leaf = Nothing
lookupList lo [] (Node mv m) = mv
lookupList lo (a:as) (Node mv m)
= lo a m >>= lookupList as
Merging Finite Maps
. Merging (possibly undefined) values.

  

Source: Abel, Andreas - Theoretische Informatik, Ludwig-Maximilians-Universität München

 

Collections: Computer Technologies and Information Sciences