Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /tests/trunk/bugs/tests.obsolete/bug878.sml
ViewVC logotype

View of /tests/trunk/bugs/tests.obsolete/bug878.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2460 - (download) (annotate)
Sat Apr 28 20:18:10 2007 UTC (12 years, 1 month ago) by gkuan
File size: 936 byte(s)
(* bug878.sml *)
(* 878. "Error: Compiler bug: getSymbols" compiling h.o. functor *)

signature MONOID =
    sig
	type t
	val plus: t * t -> t
	val e:t
    end;
    

funsig PROD (structure M:MONOID and N:MONOID) = MONOID;

functor Square (structure X:MONOID functor Prod:PROD) =
    Prod(structure M=X and N=X);
    

structure IntMonoid : MONOID =
    struct
	type t = int
	fun plus (x,y) = x+y : int
	val e = 0
    end;
    
    
functor Prod (structure M:MONOID and N:MONOID) : MONOID =
    struct
	type t = M.t * N.t
	fun plus ((m1,n1), (m2,n2) ) = (M.plus (m1,m2), N.plus(n1,n2))
	val e = (M.e,N.e)
    end;
    
structure IntPairMonoid  = Square (structure X = IntMonoid 
                                  functor Prod = Prod);
    
open IntPairMonoid;

(*
No problem if signature added to the above:
structure IntPairMonoid: MONOID  = Square (structure X = IntMonoid 
                                   functor Prod = Prod);
*)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0