comparison record.ur @ 28:f55f66c6fdee

Migrate ap method to Record module.
author Edward Z. Yang <ezyang@mit.edu>
date Thu, 26 Jul 2012 16:48:37 -0400
parents 6cd839818393
children
comparison
equal deleted inserted replaced
27:ca1c07d49b5e 28:f55f66c6fdee
10 fun equal [ts ::: {Type}] (eqs : $(map eq ts)) (fl : folder ts) (r1 : $ts) (r2 : $ts) : bool = 10 fun equal [ts ::: {Type}] (eqs : $(map eq ts)) (fl : folder ts) (r1 : $ts) (r2 : $ts) : bool =
11 @foldR3 [eq] [ident] [ident] [fn _ => bool] 11 @foldR3 [eq] [ident] [ident] [fn _ => bool]
12 (fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] isEq x y acc => 12 (fn [nm ::_] [t ::_] [r ::_] [[nm] ~ r] isEq x y acc =>
13 acc && @eq isEq x y) 13 acc && @eq isEq x y)
14 True fl eqs r1 r2 14 True fl eqs r1 r2
15
16 fun ap [K] [tf1 :: K -> Type] [tf2 :: K -> Type]
17 [r ::: {K}] (fl : folder r) (fs : $(map (fn t => tf1 t -> tf2 t) r)) (xs : $(map tf1 r))
18 = @map2 [fn t => tf1 t -> tf2 t] [fn t => tf1 t] [tf2] (fn [t] f x => f x) fl fs xs