annotate mem.urs @ 22:8de201d70b91

Implement JSON typeclass for polymorphic variants.
author Edward Z. Yang <ezyang@mit.edu>
date Wed, 02 May 2012 11:47:37 -0400
parents 943410267fad
children
rev   line source
adam@5 1 (** A record membership predicate *)
adam@5 2
adam@5 3 con mem :: K --> Name -> K -> {K} -> Type
adam@5 4
adam@5 5 val mem : K --> nm :: Name -> t :: K -> r :: {K} -> [[nm] ~ r] => mem nm t ([nm = t] ++ r)
adam@5 6 val mp : K --> K2 --> f :: (K -> K2) -> nm ::: Name -> t ::: K -> r ::: {K} -> mem nm t r -> mem nm (f t) (map f r)
adam@5 7
adam@5 8 val proj : nm ::: Name -> t ::: Type -> r ::: {Type} -> mem nm t r -> $r -> t
adam@5 9 val replace : nm ::: Name -> t ::: Type -> r ::: {Type} -> mem nm t r -> $r -> t -> $r
adam@5 10
adam@5 11 val fold : K --> tf :: ({K} -> Type) -> r ::: {K}
adam@5 12 -> (nm :: Name -> v :: K -> r' :: {K} -> [[nm] ~ r']
adam@5 13 => mem nm v r -> tf r' -> tf ([nm = v] ++ r'))
adam@5 14 -> tf []
adam@5 15 -> folder r -> tf r