comparison demo/prose @ 418:ad7e854a518c

Metaform demos, minus prose
author Adam Chlipala <adamc@hcoop.net>
date Thu, 23 Oct 2008 14:03:12 -0400
parents e0e9e9eca1cb
children cb5897276abf
comparison
equal deleted inserted replaced
417:e0e9e9eca1cb 418:ad7e854a518c
102 <p>With <tt>sum</tt> defined, it is easy to make some sample calls. The form of the code for <tt>main</tt> does not make it apparent, but the compiler must "reverse engineer" the appropriate <tt>{Unit}</tt> from the <tt>{Type}</tt> available from the context at each call to <tt>sum</tt>.</p> 102 <p>With <tt>sum</tt> defined, it is easy to make some sample calls. The form of the code for <tt>main</tt> does not make it apparent, but the compiler must "reverse engineer" the appropriate <tt>{Unit}</tt> from the <tt>{Type}</tt> available from the context at each call to <tt>sum</tt>.</p>
103 103
104 tcSum.urp 104 tcSum.urp
105 105
106 <p>It's easy to adapt the last example to use type classes, such that we can sum the fields of records based on any numeric type.</p> 106 <p>It's easy to adapt the last example to use type classes, such that we can sum the fields of records based on any numeric type.</p>
107
108 metaform1.urp
109
110 metaform2.urp