From 2ace64baba707b2e76778c74789735263eb50823 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 26 Dec 2009 11:56:40 -0500 Subject: Make summary unification more conservative; infer implicit arguments after applications --- tests/impl.ur | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'tests/impl.ur') diff --git a/tests/impl.ur b/tests/impl.ur index 5304598c..4a2e7a09 100644 --- a/tests/impl.ur +++ b/tests/impl.ur @@ -1,15 +1,18 @@ -val id = fn t :: Type => fn x : t => x +fun id [t :: Type] (x : t) = x val id_self = id [t :: Type -> t -> t] id -val idi = fn t ::: Type => fn x : t => x -val idi_self = idi idi +fun idi [t ::: Type] (x : t) = x +val idi_self = idi @@idi -val picker = fn na :: Name => fn a ::: Type => fn nb :: Name => fn b ::: Type => fn fs ::: {Type} => - fn r : $([na = a, nb = b] ++ fs) => {na = r.na, nb = r.nb} +fun picker [na :: Name] [a ::: Type] [nb :: Name] [b ::: Type] [fs ::: {Type}] [[na] ~ [nb]] [[na, nb] ~ fs] + (r : $([na = a, nb = b] ++ fs)) = {na = r.na, nb = r.nb} val getem = picker [#A] [#C] {A = 0, B = 1.0, C = "hi", D = {}} val getem2 = picker [#A] [_] {A = 0, B = 1.0, C = "hi", D = {}} val getem3 = picker [#A] [_::Name] {A = 0, B = 1.0, C = "hi", D = {}} -val picker_ohmy = fn na ::: Name => fn a ::: Type => fn nb ::: Name => fn b ::: Type => fn fs ::: {Type} => - fn r : $([na = a, nb = b] ++ fs) => {na = r.na, nb = r.nb} +fun picker_ohmy [na ::: Name] [a ::: Type] [nb ::: Name] [b ::: Type] [fs ::: {Type}] [[na] ~ [nb]] [[na, nb] ~ fs] + (r : $([na = a, nb = b] ++ fs)) = {na = r.na, nb = r.nb} val getem_ohmy = picker_ohmy {A = 0, B = 1.0, C = "hi", D = {}} + +fun proj [fs] [t] [nm :: Name] [[nm] ~ fs] (r : $([nm = t] ++ fs)) = r.nm +val one = proj [#A] {A = 1, B = True} -- cgit v1.2.3