diff tests/newMessage.ur @ 1736:7ec8dab190a7

Better discovery of type class instances from recursive definitions
author Adam Chlipala <adam@chlipala.net>
date Wed, 02 May 2012 08:34:50 -0400
parents
children
line wrap: on
line diff
--- /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})