Article View: uiuc.cs.sml
Article #1modules system and type sharing
From: Joshua Caplan
Date: Mon, 27 Jul 1992 06:09
Date: Mon, 27 Jul 1992 06:09
52 lines
1763 bytes
1763 bytes
Suppose I have a signature signature S = sig eqtype i (* various declarations involving type i *) end and wish to implement a functor functor F (s : S) = struct type j = (* representation for j *) (* various appearances of the things in s *) end where I know that type s.i = type j ? I can think of only one way, which I hate: signature RequiredArgToF = sig datatype j = USELESS_TAG of (* representation for j *) end functor F (structure s : S and t : RequiredArgToF sharing type s.i = t.j) = struct local open t in type j = j (* various appearances of the things in s and *) (* lots of USELESS_TAGs *) end end This solution requires me to move the type declarations needed in F outside of F to be sent in as a required argument, and makes me stick tags all over the place which I don't really need. If it were possible to pass F an argument of functor type ((sig eqtype i end) -> S), the result would be beautiful. But alas, that might complicate the modules system type discipline too much. Suggestions? -- ------------------------+------------------------------------------------- caplan@cs.uiuc.edu | Joshua Caplan | Department of Computer Science | University of Illinois at Urbana-Champaign
Technical Details
Message-ID:
<1992Jul27.060927.23318@m.cs.uiuc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!ux1.cso.uiuc.edu!m.cs.uiuc.edu!caplanShow Full Headers
Complete Article Headers
Newsgroups: uiuc.cs.sml,alt.lang.ml Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!ux1.cso.uiuc.edu!m.cs.uiuc.edu!caplan From: caplan@m.cs.uiuc.edu (Joshua Caplan) Subject: modules system and type sharing Message-ID: <1992Jul27.060927.23318@m.cs.uiuc.edu> Summary: good puzzler Keywords: functor structure signature type sharing parameters Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL Date: Mon, 27 Jul 1992 06:09:27 GMT Lines: 52