Mercurial > urweb
annotate tests/impl.ur @ 416:679b2fbbd4d0
Counter demo
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 23 Oct 2008 11:59:48 -0400 |
parents | 71bafe66dbe1 |
children | 8d3aa6c7cee0 |
rev | line source |
---|---|
adamc@15 | 1 val id = fn t :: Type => fn x : t => x |
adamc@15 | 2 val id_self = id [t :: Type -> t -> t] id |
adamc@15 | 3 |
adamc@15 | 4 val idi = fn t ::: Type => fn x : t => x |
adamc@15 | 5 val idi_self = idi idi |
adamc@17 | 6 |
adamc@17 | 7 val picker = fn na :: Name => fn a ::: Type => fn nb :: Name => fn b ::: Type => fn fs ::: {Type} => |
adamc@17 | 8 fn 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@17 | 13 val picker_ohmy = fn na ::: Name => fn a ::: Type => fn nb ::: Name => fn b ::: Type => fn fs ::: {Type} => |
adamc@17 | 14 fn 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 = {}} |