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/bug749.sml
ViewVC logotype

View of /tests/trunk/bugs/tests.obsolete/bug749.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: 588 byte(s)
(* bug749.sml *)
(* 749. nonequality type identified as equality type *)

signature EQTYPE  =
sig
  type T
  val eq : T * T -> bool
end;

structure S: EQTYPE =
struct
  type T = int -> int
  fun eq _ = false
end;

functor ProductEqTypeFUN (structure t1 : EQTYPE and t2 : EQTYPE) 
			: EQTYPE =
struct
  type T = t1.T * t2.T
  val eq = op=   (* this should not work because '=' not defined *)
end;

structure SS = ProductEqTypeFUN (structure t1 = S  structure t2 = S);

fun f x = x + 1;
fun g x = x - 1;

(* now SS.eq((f, f), (f, f)) yields true and
SS.eq((f, f), (g, g)) yields false. *)

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