Mercurial > urweb
diff demo/prose @ 417:e0e9e9eca1cb
Fix nasty de Bruijn substitution bug; TcSum demo
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 23 Oct 2008 12:58:35 -0400 |
parents | 679b2fbbd4d0 |
children | ad7e854a518c |
line wrap: on
line diff
--- a/demo/prose Thu Oct 23 11:59:48 2008 -0400 +++ b/demo/prose Thu Oct 23 12:58:35 2008 -0400 @@ -100,3 +100,7 @@ <p>The general syntax for constant row types is <tt>[Name1 = t1, ..., NameN = tN]</tt>, and there is a shorthand version <tt>[Name1, ..., NameN]</tt> for records of <tt>Unit</tt>s.</p> <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> + +tcSum.urp + +<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>