# HG changeset patch # User Adam Chlipala # Date 1335962090 14400 # Node ID 7ec8dab190a78680f4060734d9d38f9cb1998065 # Parent ec47f49c6aa34dcbc63f7ef0b7de367ca4c642cf Better discovery of type class instances from recursive definitions diff -r ec47f49c6aa3 -r 7ec8dab190a7 src/elaborate.sml --- a/src/elaborate.sml Wed May 02 08:23:30 2012 -0400 +++ b/src/elaborate.sml Wed May 02 08:34:50 2012 -0400 @@ -3912,8 +3912,11 @@ expError env (IllegalRec (x, e')); ((x, n, c', e'), gs1 @ gs) end) gs vis + + val vis = map (fn (x, n, t, e) => (x, n, normClassConstraint env t, e)) vis + val d = (L'.DValRec vis, loc) in - ([(L'.DValRec vis, loc)], (env, denv, gs)) + ([d], (E.declBinds env d, denv, gs)) end | L.DSgn (x, sgn) => diff -r ec47f49c6aa3 -r 7ec8dab190a7 tests/newMessage.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/newMessage.ur Wed May 02 08:34:50 2012 -0400 @@ -0,0 +1,15 @@ +datatype message = NewQuestion of { Id : string} + | Something of {Blah : int} + +fun showMessage (message : message) = + case message of + NewQuestion {Id = a} => a + | Something {Blah = x} => "blah" + +val show_mes = mkShow showMessage + +fun showTwoTuple [a] [b] (_ : show a) (_: show b) = mkShow (fn (two_tuple : {1:a, 2:b}) => + "(" ^ show two_tuple.1 ^ ", " ^ show two_tuple.2 ^ ")" + + ) +val om = show (Something {Blah = 1}, Something {Blah = 2})