changeset 33:535c324f0b35

Matching structures in signatures
author Adam Chlipala <adamc@hcoop.net>
date Thu, 12 Jun 2008 17:41:32 -0400
parents 0ff8c2728634
children 44b5405e74c7
files src/elaborate.sml tests/modules.lac
diffstat 2 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/elaborate.sml	Thu Jun 12 17:35:51 2008 -0400
+++ b/src/elaborate.sml	Thu Jun 12 17:41:32 2008 -0400
@@ -1085,7 +1085,14 @@
                                      end
                                    | _ => NONE)
 
-                      | _ => raise Fail "Not ready for more sig matching"
+                      | L'.SgiStr (x, n2, sgn2) =>
+                        seek (fn sgi1All as (sgi1, _) =>
+                                 case sgi1 of
+                                     L'.SgiStr (x, n1, sgn1) =>
+                                     (subSgn env sgn1 sgn2;
+                                      SOME env)
+                                   | _ => NONE)
+                        (* Add type equations between structures here some day. *)
                 end
         in
             ignore (foldl folder env sgis2)
--- a/tests/modules.lac	Thu Jun 12 17:35:51 2008 -0400
+++ b/tests/modules.lac	Thu Jun 12 17:41:32 2008 -0400
@@ -57,3 +57,19 @@
         type s = int
         type t = float
 end
+
+
+structure N = struct
+        type t = string
+        structure N2 = struct
+                type t = int
+                val zero = 0
+        end
+        val x = "Hi"
+end
+signature N = sig
+        structure N2 : NAT
+        type t
+        val x : t
+end
+structure No : N = N