2002-06-18 03:47:33 -07:00
|
|
|
Objective Caml version 3.04+15 (2002-06-18)
|
2002-02-16 06:46:24 -08:00
|
|
|
|
2002-06-18 01:50:52 -07:00
|
|
|
# * * * # type 'a t = { t : 'a; }
|
2002-02-16 06:46:24 -08:00
|
|
|
# type 'a fold = { fold : 'b. f:('b -> 'a -> 'b) -> init:'b -> 'b; }
|
|
|
|
# val f : 'a list -> 'a fold = <fun>
|
|
|
|
# - : int = 6
|
|
|
|
# class ['a] ilist :
|
|
|
|
'a list ->
|
|
|
|
object ('b)
|
|
|
|
val l : 'a list
|
|
|
|
method add : 'a -> 'b
|
2002-06-18 01:50:52 -07:00
|
|
|
method fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# class virtual ['a] vlist :
|
|
|
|
object ('b)
|
|
|
|
method virtual add : 'a -> 'b
|
2002-06-18 01:50:52 -07:00
|
|
|
method virtual fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# class ilist2 :
|
|
|
|
int list ->
|
|
|
|
object ('a)
|
|
|
|
val l : int list
|
|
|
|
method add : int -> 'a
|
2002-06-18 01:50:52 -07:00
|
|
|
method fold : f:('b -> int -> 'b) -> init:'b -> 'b
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# class ['a] ilist3 :
|
|
|
|
'a list ->
|
|
|
|
object ('b)
|
|
|
|
val l : 'a list
|
|
|
|
method add : 'a -> 'b
|
2002-06-18 01:50:52 -07:00
|
|
|
method fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# class ['a] ilist4 :
|
|
|
|
'a list ->
|
|
|
|
object ('b)
|
|
|
|
val l : 'a list
|
|
|
|
method add : 'a -> 'b
|
2002-06-18 01:50:52 -07:00
|
|
|
method fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# class ['a] ilist5 :
|
|
|
|
'a list ->
|
|
|
|
object ('b)
|
|
|
|
val l : 'a list
|
|
|
|
method add : 'a -> 'b
|
2002-06-18 01:50:52 -07:00
|
|
|
method fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
|
|
|
method fold2 : f:('d -> 'a -> 'd) -> init:'d -> 'd
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# class ['a] ilist6 :
|
|
|
|
'a list ->
|
|
|
|
object ('b)
|
|
|
|
val l : 'a list
|
|
|
|
method add : 'a -> 'b
|
2002-06-18 01:50:52 -07:00
|
|
|
method fold : f:('c -> 'a -> 'c) -> init:'c -> 'c
|
|
|
|
method fold2 : f:('d -> 'a -> 'd) -> init:'d -> 'd
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# class virtual ['a] olist :
|
2002-06-18 01:50:52 -07:00
|
|
|
object method virtual fold : f:('a -> 'b -> 'b) -> init:'b -> 'b end
|
2002-02-16 06:46:24 -08:00
|
|
|
# class ['a] onil :
|
2002-06-18 01:50:52 -07:00
|
|
|
object method fold : f:('a -> 'b -> 'b) -> init:'b -> 'b end
|
2002-02-16 06:46:24 -08:00
|
|
|
# class ['a] ocons :
|
|
|
|
hd:'a ->
|
|
|
|
tl:'a olist ->
|
|
|
|
object
|
|
|
|
val hd : 'a
|
|
|
|
val tl : 'a olist
|
2002-06-18 01:50:52 -07:00
|
|
|
method fold : f:('a -> 'b -> 'b) -> init:'b -> 'b
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# class ['a] ostream :
|
|
|
|
hd:'a ->
|
|
|
|
tl:'a ostream ->
|
|
|
|
object
|
|
|
|
val hd : 'a
|
|
|
|
val tl : 'a ostream
|
|
|
|
method empty : bool
|
2002-06-18 01:50:52 -07:00
|
|
|
method fold : f:('a -> 'b -> 'b) -> init:'b -> 'b
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# class ['a] ostream1 :
|
|
|
|
hd:'a ->
|
|
|
|
tl:'b ->
|
|
|
|
object ('b)
|
|
|
|
val hd : 'a
|
|
|
|
val tl : 'b
|
2002-06-18 01:50:52 -07:00
|
|
|
method fold : f:('a -> 'c -> 'c) -> init:'c -> 'c
|
2002-02-16 06:46:24 -08:00
|
|
|
method hd : 'a
|
|
|
|
method tl : 'b
|
|
|
|
end
|
2002-06-18 01:50:52 -07:00
|
|
|
# class vari : object method m : [< `A | `B | `C] -> int end
|
|
|
|
# class vari : object method m : [< `A | `B | `C] -> int end
|
|
|
|
# module V : sig type v = [ `A | `B | `C] val m : [< v] -> int end
|
|
|
|
# class varj : object method m : [< V.v] -> int end
|
2002-02-16 06:46:24 -08:00
|
|
|
# module type T =
|
2002-06-18 01:50:52 -07:00
|
|
|
sig class vari : object method m : [< `A | `B | `C] -> int end end
|
2002-02-16 06:46:24 -08:00
|
|
|
# module M0 :
|
2002-06-18 01:50:52 -07:00
|
|
|
sig class vari : object method m : [< `A | `B | `C] -> int end end
|
2002-02-16 06:46:24 -08:00
|
|
|
# module M : T
|
|
|
|
# val v : M.vari = <obj>
|
|
|
|
# - : int = 1
|
|
|
|
# class point :
|
|
|
|
x:int ->
|
|
|
|
y:int -> object val x : int val y : int method x : int method y : int end
|
|
|
|
# class color_point :
|
|
|
|
x:int ->
|
|
|
|
y:int ->
|
|
|
|
color:string ->
|
|
|
|
object
|
|
|
|
val color : string
|
|
|
|
val x : int
|
|
|
|
val y : int
|
|
|
|
method color : string
|
|
|
|
method x : int
|
|
|
|
method y : int
|
|
|
|
end
|
|
|
|
# class circle :
|
|
|
|
#point ->
|
|
|
|
r:int ->
|
2002-06-18 01:50:52 -07:00
|
|
|
object val p : point val r : int method distance : #point -> float end
|
2002-02-16 06:46:24 -08:00
|
|
|
# val p0 : point = <obj>
|
|
|
|
val p1 : point = <obj>
|
|
|
|
val cp : color_point = <obj>
|
|
|
|
val c : circle = <obj>
|
|
|
|
val d : float = 11.4536240471
|
|
|
|
# val f : < m : 'a. 'a -> 'a > -> < m : 'a. 'a -> 'a > = <fun>
|
|
|
|
# Characters 41-42:
|
|
|
|
This expression has type < m : 'a. 'a -> 'a list > but is here used with type
|
|
|
|
< m : 'a. 'a -> 'b >
|
2002-06-18 03:47:33 -07:00
|
|
|
The universal variable 'a would escape its scope
|
2002-06-18 01:50:52 -07:00
|
|
|
# class id : object method id : 'a -> 'a end
|
|
|
|
# class type id_spec = object method id : 'a -> 'a end
|
|
|
|
# class id_impl : object method id : 'a -> 'a end
|
2002-02-16 06:46:24 -08:00
|
|
|
# class a : object method m : bool end
|
2002-06-18 01:50:52 -07:00
|
|
|
class b : object method id : 'a -> 'a end
|
2002-02-16 06:46:24 -08:00
|
|
|
# Characters 72-77:
|
|
|
|
This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
|
|
|
|
# Characters 75-80:
|
|
|
|
This method has type 'a -> 'a which is less general than 'b. 'b -> 'a
|
|
|
|
# Characters 80-85:
|
|
|
|
This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
|
|
|
|
# Characters 92-159:
|
|
|
|
This method has type 'a -> 'a which is less general than 'b. 'b -> 'b
|
2002-06-18 01:50:52 -07:00
|
|
|
# class c : object method m : 'a -> 'b -> 'a end
|
2002-02-16 06:46:24 -08:00
|
|
|
# val f1 : id -> int * bool = <fun>
|
|
|
|
# val f2 : id -> int * bool = <fun>
|
|
|
|
# Characters 24-28:
|
|
|
|
This expression has type bool but is here used with type int
|
2002-06-18 01:50:52 -07:00
|
|
|
# val f4 : id -> int * bool = <fun>
|
|
|
|
# class c : object method m : #id -> int * bool end
|
|
|
|
# class id2 : object method id : 'a -> 'a method mono : int -> int end
|
|
|
|
# val app : int * bool = (1, true)
|
2002-02-16 06:46:24 -08:00
|
|
|
# Characters 4-25:
|
|
|
|
The type abbreviation foo is cyclic
|
|
|
|
# class ['a] bar : 'a -> object end
|
|
|
|
# type 'a foo = 'a foo bar
|
|
|
|
# - : (< m : 'b. 'b * 'a > as 'a) -> 'c * 'a = <fun>
|
|
|
|
# - : (< m : 'b. 'a * 'b list > as 'a) -> 'a * 'c list = <fun>
|
|
|
|
# val f :
|
|
|
|
(< m : 'b. 'a * (< n : 'b; .. > as 'b) > as 'a) ->
|
|
|
|
'a * (< n : 'c; .. > as 'c) = <fun>
|
|
|
|
# - : (< p : 'b. < m : 'b; n : 'a; .. > as 'b > as 'a) ->
|
|
|
|
(< m : 'c; n : 'a; .. > as 'c)
|
|
|
|
= <fun>
|
|
|
|
# type sum = T of < id : 'a. 'a -> 'a >
|
|
|
|
# - : sum -> 'a -> 'a = <fun>
|
|
|
|
# type record = { r : < id : 'a. 'a -> 'a >; }
|
|
|
|
# - : record -> 'a -> 'a = <fun>
|
|
|
|
# - : record -> 'a -> 'a = <fun>
|
2002-06-18 01:50:52 -07:00
|
|
|
# class myself : object ('a) method self : 'b -> 'a end
|
2002-02-16 06:46:24 -08:00
|
|
|
# class number :
|
|
|
|
object ('a)
|
|
|
|
val num : int
|
|
|
|
method num : int
|
|
|
|
method prev : 'a
|
|
|
|
method succ : 'a
|
2002-06-18 01:50:52 -07:00
|
|
|
method switch : zero:(unit -> 'b) -> prev:('a -> 'b) -> 'b
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# val id : 'a -> 'a = <fun>
|
2002-06-18 01:50:52 -07:00
|
|
|
# class c : object method id : 'a -> 'a end
|
|
|
|
# class c' : object method id : 'a -> 'a end
|
2002-02-16 06:46:24 -08:00
|
|
|
# class d :
|
|
|
|
object
|
|
|
|
val mutable count : int
|
|
|
|
method count : int
|
2002-06-18 01:50:52 -07:00
|
|
|
method id : 'a -> 'a
|
|
|
|
method old : 'b -> 'b
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# class ['a] olist :
|
|
|
|
'a list ->
|
|
|
|
object ('b)
|
|
|
|
val l : 'a list
|
|
|
|
method cons : 'a -> 'b
|
2002-06-18 01:50:52 -07:00
|
|
|
method fold : f:('a -> 'c -> 'c) -> init:'c -> 'c
|
2002-02-16 06:46:24 -08:00
|
|
|
end
|
|
|
|
# val sum : int #olist -> int = <fun>
|
|
|
|
# val count : 'a #olist -> int = <fun>
|
|
|
|
# val append : 'a #olist -> ('a #olist as 'b) -> 'b = <fun>
|
|
|
|
# type 'a t = unit
|
2002-06-18 01:50:52 -07:00
|
|
|
# class o : object method x : [> `A] t -> unit end
|
2002-02-16 06:46:24 -08:00
|
|
|
# class c : object method m : d end
|
|
|
|
class d : ?x:int -> unit -> object end
|
|
|
|
# class d : ?x:int -> unit -> object end
|
|
|
|
class c : object method m : d end
|
2002-06-18 01:50:52 -07:00
|
|
|
# class type numeral = object method fold : ('a -> 'a) -> 'a -> 'a end
|
|
|
|
class zero : object method fold : ('a -> 'a) -> 'a -> 'a end
|
|
|
|
class next : #numeral -> object method fold : ('a -> 'a) -> 'a -> 'a end
|
2002-07-07 22:58:50 -07:00
|
|
|
# class type node_type = object method as_variant : [> `Node of node_type] end
|
|
|
|
# class node : node_type
|
|
|
|
# class node : object method as_variant : [> `Node of node_type] end
|
2002-02-16 06:46:24 -08:00
|
|
|
#
|