Mercurial > meta
annotate record.ur @ 12:a6730c3cfea7
Record.equal
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 08 Feb 2011 16:52:41 -0500 |
parents | 67b33be5d56a |
children | 6cd839818393 |
rev | line source |
---|---|
adam@11 | 1 fun numFields [r ::: {Type}] (fl : folder r) (r : $r) : int = |
adam@11 | 2 @fold [fn _ => int] (fn [nm ::_] [u ::_] [r ::_] [[nm] ~ r] acc => acc+1) 0 fl |
adam@11 | 3 |
adam@10 | 4 fun mem [a ::: Type] [ns ::: {Unit}] (_ : eq a) (fl : folder ns) (x : a) (r : $(mapU a ns)) : bool = |
adam@10 | 5 @foldUR [a] [fn _ => bool] |
adam@10 | 6 (fn [nm ::_] [r ::_] [[nm] ~ r] y acc => |
adam@10 | 7 acc || x = y) |
adam@10 | 8 False fl r |
adam@12 | 9 |
adam@12 | 10 fun equal [ts ::: {Type}] (eqs : $(map eq ts)) (fl : folder ts) (r1 : $ts) (r2 : $ts) : bool = |
adam@12 | 11 @foldR3 [eq] [id] [id] [fn _ => bool] |
adam@12 | 12 (fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] isEq x y acc => |
adam@12 | 13 acc && @eq isEq x y) |
adam@12 | 14 True fl eqs r1 r2 |