camlspotter avatar camlspotter committed fb056e5

added an example

Comments (0)

Files changed (2)

dcamltests/Makefile.targets

 constraint.cmo \
 constraint2.cmo \
 derivable.cmo \
-dummy.cmo \
-dummy.cmi \
 eq.cmo \
 error_multi.cmo \
 error_unmatched_pattern.cmo \
 flat.cmo \
 inherit.cmo \
 loop.cmo \
-lousy.cmo \
 multi.cmo \
 new_resolution.cmo \
 new_resolution2.cmo \
 nodes.cmo \
 nodes_resolve.cmo \
+non_dabstractable.cmo \
 oo001.cmo \
 oo002.cmo \
 opvar.cmo \
 sum4.cmo \
 sum_class.cmo \
 sum_class_by_functor.cmo \
+sum_ideal.cmo \
+sum_in_blog.cmo \
 test001.cmo \
 test002.cmo \
 test003.cmo \

dcamltests/non_dabstractable.ml

+(* non dabstractable *)
+
+module Class : sig
+  type 'a t
+  val v : $:'a t -> 'a
+  val make : 'a -> 'a t
+end = struct
+  type 'a t = 'a
+  let v $:x = x
+  let make x = x
+end
+
+module Int = struct
+  let t = Class.make 1
+end
+
+module Float = struct
+  let t = Class.make 1.0
+end
+
+module Tuple = struct
+  let t = Class.make (Class.v, Class.v)
+end
+
+module M : sig
+  type 'a t
+  val v : $:'a t -> 'a
+  module Int : sig val t : int t end
+  module Float : sig val t : float t end
+  module Tuple : sig val t : $:'a t -> $:'b t -> ('a * 'b) t end
+end = struct
+  include Class
+  module Int = Int
+  module Float = Float
+  module Tuple = Tuple
+end
+
+let () = 
+  assert (M.v = 1);
+  assert (M.v = 1.0);
+  assert (M.v = (1,1));
+;;
+
+let x : int * int = M.v (* ok, since it is equivalent with the following *)
+let x = (M.v : int * int)
+
+let (x : int * int) = M.v (* does not work *)
+
+let _ = let x,y = M.v in x + y
+
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.