comparison variant.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 ca1c07d49b5e
children 7530b2b54353
comparison
equal deleted inserted replaced
27:ca1c07d49b5e 28:f55f66c6fdee
140 class type_case = fn ts t a => (a -> variant ts) -> a -> t 140 class type_case = fn ts t a => (a -> variant ts) -> a -> t
141 141
142 fun declareCase [ts] [t] [a] (f : (a -> variant ts) -> a -> t) : type_case ts t a = f 142 fun declareCase [ts] [t] [a] (f : (a -> variant ts) -> a -> t) : type_case ts t a = f
143 fun typeCase [ts] [t] (v : variant ts) (dstrs : $(map (type_case ts t) ts)) (fl : folder ts) : t 143 fun typeCase [ts] [t] (v : variant ts) (dstrs : $(map (type_case ts t) ts)) (fl : folder ts) : t
144 (* Ur/Web not clever enough to calculate these folders, it seems *) 144 (* Ur/Web not clever enough to calculate these folders, it seems *)
145 = match v (@ap [fn a => a -> variant ts] [fn a => a -> t] fl dstrs (@mkLabels fl)) 145 = match v (@Record.ap [fn a => a -> variant ts] [fn a => a -> t] fl dstrs (@mkLabels fl))