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 | 2e606b03c8dbc594610e62ac260145ac26ebc699 (patch) | |
tree | 23055572341487865f0ef6cff685404f796a2410 /demo/prose | |
parent | 3b7e65be5f6e496c23df7909d50ce8e287d571d7 (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> |