diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-10-23 12:58:35 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-10-23 12:58:35 -0400 |
commit | 0fa422bfaf3931aacff958cb73d44ebfa4191f4a (patch) | |
tree | 23055572341487865f0ef6cff685404f796a2410 /demo/prose | |
parent | 833f4d2e0474ec3ff772107b52711289c4b648cf (diff) |
Fix nasty de Bruijn substitution bug; TcSum demo
Diffstat (limited to 'demo/prose')
-rw-r--r-- | demo/prose | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -100,3 +100,7 @@ An unusual part of the third argument is the syntax <tt>[t1 ~ t2]</tt> within a <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> |