changeset 1654:570636457047

Add arguments to [type] declarations and signature items
author Adam Chlipala <adam@chlipala.net>
date Mon, 02 Jan 2012 15:38:52 -0500 (2012-01-02)
parents 1a8f7d667c00
children b694f9153faa
files src/urweb.grm
diffstat 1 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/urweb.grm	Sat Dec 31 16:08:17 2011 -0500
+++ b/src/urweb.grm	Mon Jan 02 15:38:52 2012 -0500
@@ -473,8 +473,14 @@
                                          in
                                              [(DCon (SYMBOL, SOME k, c), loc)]
                                          end)
-       | LTYPE SYMBOL EQ cexp           ([(DCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
-                                           s (LTYPEleft, cexpright))])
+       | LTYPE SYMBOL cargl2 EQ cexp    (let
+                                             val loc = s (LTYPEleft, cexpright)
+
+                                             val k = (KWild, loc)
+                                             val (c, k) = cargl2 (cexp, k)
+                                         in
+                                             [(DCon (SYMBOL, SOME k, c), loc)]
+                                         end)
        | DATATYPE dtypes                ([(DDatatype dtypes, s (DATATYPEleft, dtypesright))])
        | DATATYPE SYMBOL dargs EQ DATATYPE CSYMBOL DOT path
                 (case dargs of
@@ -756,8 +762,20 @@
                                                      (SgiCon (SYMBOL, SOME k, c), loc)
                                                  end
                                          end)
-       | LTYPE SYMBOL EQ cexp           ((SgiCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
-                                          s (LTYPEleft, cexpright)))
+       | LTYPE SYMBOL cargl2 cexpO      (let
+                                             val loc = s (LTYPEleft, cexpOright)
+
+                                             val k = (KWild, loc)
+                                         in
+                                             case cexpO of
+                                                 NONE => (SgiConAbs (SYMBOL, k), loc)
+                                               | SOME cexp =>
+                                                 let
+                                                     val (c, k) = cargl2 (cexp, k)
+                                                 in
+                                                     (SgiCon (SYMBOL, SOME k, c), loc)
+                                                 end
+                                         end)
        | DATATYPE dtypes                ((SgiDatatype dtypes, s (DATATYPEleft, dtypesright)))
        | DATATYPE SYMBOL dargs EQ DATATYPE CSYMBOL DOT path
                 (case dargs of