CVS: sml-dist/src/compiler/ElabData/types typesutil.sml, 1.3.2.4, 1.3.2.5
George Kuan <[email protected]> Wed, 05 Jul 2006 20:07:22 -0700
| Newsgroups | gmane.comp.lang.sml.smlnj.commits |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/smlnj/sml-dist/src/compiler/ElabData/types
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv30688/ElabData/types
Modified Files:
Tag: primop-branch-2
typesutil.sml
Log Message:
Moved matchTypes to TypeUtils
Index: typesutil.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/compiler/ElabData/types/typesutil.sml,v
retrieving revision 1.3.2.4
retrieving revision 1.3.2.5
diff -C2 -d -r1.3.2.4 -r1.3.2.5
*** typesutil.sml 20 Jun 2006 04:18:10 -0000 1.3.2.4
--- typesutil.sml 6 Jul 2006 03:07:17 -0000 1.3.2.5
***************
*** 507,510 ****
--- 507,541 ----
end handle CompareTypes => false
+ (* matchTypes -- one-way matching of actual to spec type; yields
+ list of instantiation metavariables
+ Parameters:
+ spec -- specification type
+ actual -- actual type
+ Returns:
+ (specGenericTvs, -- spec metavariables that are generalized
+ in the match
+ actParamTvs) -- metavariables in actual type that are instantiations
+ of spec metavariables in match
+ Invariant: specGenericTvs are always instantiated but
+ actInstTvs are never generalized (because they are only
+ meaningful in this function and are immediately generalized
+ away.
+ Comments: compareTypes does pruning so there is no need to prune in
+ this function or anywhere else that uses compareTypes or
+ matchTypes.
+ *)
+ fun matchTypes (specTy, actualTy) =
+ (* If specTy is not an instance of actualTy, then give up. *)
+ if compareTypes(specTy, actualTy) then
+ let
+ val (actinst, actParamTvs) =
+ instantiatePoly actual
+ val (specinst, specGenericTvs) =
+ instantiatePoly spec
+ in
+ (specGenericTvs, actParamTvs)
+ end
+ else ([], [])
+
(* given a single-type-variable type, extract out the tyvar *)
fun tyvarType (VARty (tv as ref(OPEN _))) = tv
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642