annotate tests/impl.ur @ 1302:d008c4c43a0a

Flex kinds for type-level tuples; ::_ notation
author Adam Chlipala <adam@chlipala.net>
date Sun, 10 Oct 2010 13:07:38 -0400
parents 8d3aa6c7cee0
children
rev   line source
adamc@1093 1 fun id [t :: Type] (x : t) = x
adamc@15 2 val id_self = id [t :: Type -> t -> t] id
adamc@15 3
adamc@1093 4 fun idi [t ::: Type] (x : t) = x
adamc@1093 5 val idi_self = idi @@idi
adamc@17 6
adamc@1093 7 fun picker [na :: Name] [a ::: Type] [nb :: Name] [b ::: Type] [fs ::: {Type}] [[na] ~ [nb]] [[na, nb] ~ fs]
adamc@1093 8 (r : $([na = a, nb = b] ++ fs)) = {na = r.na, nb = r.nb}
adamc@17 9 val getem = picker [#A] [#C] {A = 0, B = 1.0, C = "hi", D = {}}
adamc@18 10 val getem2 = picker [#A] [_] {A = 0, B = 1.0, C = "hi", D = {}}
adamc@18 11 val getem3 = picker [#A] [_::Name] {A = 0, B = 1.0, C = "hi", D = {}}
adamc@17 12
adamc@1093 13 fun picker_ohmy [na ::: Name] [a ::: Type] [nb ::: Name] [b ::: Type] [fs ::: {Type}] [[na] ~ [nb]] [[na, nb] ~ fs]
adamc@1093 14 (r : $([na = a, nb = b] ++ fs)) = {na = r.na, nb = r.nb}
adamc@17 15 val getem_ohmy = picker_ohmy {A = 0, B = 1.0, C = "hi", D = {}}
adamc@1093 16
adamc@1093 17 fun proj [fs] [t] [nm :: Name] [[nm] ~ fs] (r : $([nm = t] ++ fs)) = r.nm
adamc@1093 18 val one = proj [#A] {A = 1, B = True}