annotate tests/impl.ur @ 2240:88cc0f44c940
Rename C functions and remove functors nested inside modules.
author |
Ziv Scully <ziv@mit.edu> |
date |
Sun, 19 Jul 2015 19:03:11 -0700 |
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}
|