Source

mutated_ocaml / testsuite / tests / typing-gadts / test.ml

Diff from to

File testsuite/tests/typing-gadts/test.ml

-module Exp = 
+module Exp =
   struct
 
-    type _ t = 
+    type _ t =
       | IntLit : int -> int t
       | BoolLit : bool -> bool t
       | Pair : 'a t * 'b t -> ('a * 'b) t
       | App : ('a -> 'b) t * 'a t -> 'b t
-      | Abs : ('a -> 'b) -> ('a -> 'b) t 
+      | Abs : ('a -> 'b) -> ('a -> 'b) t
 
 
-    let rec eval : type s . s t -> s = 
+    let rec eval : type s . s t -> s =
       function
-	| IntLit x -> x
-	| BoolLit y -> y
-	| Pair (x,y) ->
+        | IntLit x -> x
+        | BoolLit y -> y
+        | Pair (x,y) ->
             (eval x,eval y)
-	| App (f,a) ->
-	    (eval f) (eval a)
-	| Abs f -> f 
+        | App (f,a) ->
+            (eval f) (eval a)
+        | Abs f -> f
 
     let discern : type a. a t -> _ = function
         IntLit _ -> 1
   end
 ;;
 
-module List = 
+module List =
   struct
     type zero
-    type _ t = 
+    type _ t =
       | Nil : zero t
       | Cons : 'a * 'b t -> ('a * 'b) t
     let head =
       function
-	| Cons (a,b) -> a
+        | Cons (a,b) -> a
     let tail =
       function
-	| Cons (a,b) -> b
-    let rec length : type a . a t -> int = 
+        | Cons (a,b) -> b
+    let rec length : type a . a t -> int =
       function
-	| Nil -> 0
-	| Cons (a,b) -> length b
+        | Nil -> 0
+        | Cons (a,b) -> length b
   end
 ;;
 
-module Nonexhaustive = 
+module Nonexhaustive =
   struct
-    type 'a u = 
-      | C1 : int -> int u 
+    type 'a u =
+      | C1 : int -> int u
       | C2 : bool -> bool u
-	    
-    type 'a v = 
+
+    type 'a v =
       | C1 : int -> int v
 
-    let unexhaustive : type s . s u -> s = 
+    let unexhaustive : type s . s u -> s =
       function
-	| C2 x -> x
+        | C2 x -> x
 
 
-    module M : sig type t type u end = 
+    module M : sig type t type u end =
       struct
         type t = int
         type u = bool
-      end	    
-    type 'a t = 
-      | Foo : M.t -> M.t t 
+      end
+    type 'a t =
+      | Foo : M.t -> M.t t
       | Bar : M.u -> M.u t
     let same_type : type s . s t * s t -> bool  =
       function
-	| Foo _ , Foo _ -> true
-	| Bar _, Bar _ -> true
+        | Foo _ , Foo _ -> true
+        | Bar _, Bar _ -> true
   end
 ;;
 
-module Exhaustive = 
+module Exhaustive =
   struct
     type t = int
     type u = bool
-    type 'a v = 
-      | Foo : t -> t v 
+    type 'a v =
+      | Foo : t -> t v
       | Bar : u -> u v
 
     let same_type : type s . s v * s v -> bool  =
       function
-	| Foo _ , Foo _ -> true
-	| Bar _, Bar _ -> true    
+        | Foo _ , Foo _ -> true
+        | Bar _, Bar _ -> true
   end
 ;;
 
-module Existential_escape = 
+module Existential_escape =
   struct
     type _ t = C : int -> int t
     type u = D : 'a t -> u
   end
 ;;
 
-module Rectype = 
+module Rectype =
   struct
-    type (_,_) t = C : ('a,'a) t 
-    let _ = 
+    type (_,_) t = C : ('a,'a) t
+    let _ =
       fun (type s) ->
-	let a : (s, s * s) t = failwith "foo" in 
-	match a with
-	  C ->
-	    ()
+        let a : (s, s * s) t = failwith "foo" in
+        match a with
+          C ->
+            ()
   end
 ;;
 
-module Or_patterns = 
+module Or_patterns =
 struct
-      type _ t = 
+      type _ t =
       | IntLit : int -> int t
       | BoolLit : bool -> bool t
 
-    let rec eval : type s . s t -> unit = 
+    let rec eval : type s . s t -> unit =
       function
-	| (IntLit _ | BoolLit _) -> ()
+        | (IntLit _ | BoolLit _) -> ()
 
 end
 ;;
 
-module Polymorphic_variants = 
+module Polymorphic_variants =
   struct
-      type _ t = 
+      type _ t =
       | IntLit : int -> int t
       | BoolLit : bool -> bool t
 
-    let rec eval : type s . [`A] * s t -> unit = 
+    let rec eval : type s . [`A] * s t -> unit =
       function
-	| `A, IntLit _ -> ()
-	| `A, BoolLit _ -> ()
-  end    
+        | `A, IntLit _ -> ()
+        | `A, BoolLit _ -> ()
+  end
 ;;
 
 module Propagation = struct
-  type _ t = 
+  type _ t =
       IntLit : int -> int t
     | BoolLit : bool -> bool t
 
 type _ int_foo =
   | IF_constr : <foo:int; ..> int_foo
 
-type _ int_bar = 
+type _ int_bar =
   | IB_constr : <bar:int; ..> int_bar
 ;;