fix result types on ski_evaluator
authorJim <jim.pryor@nyu.edu>
Wed, 25 Mar 2015 09:59:47 +0000 (05:59 -0400)
committerJim <jim.pryor@nyu.edu>
Wed, 25 Mar 2015 09:59:47 +0000 (05:59 -0400)
code/ski_evaluator.ml

index 7837880..11e8dd4 100644 (file)
@@ -42,7 +42,7 @@ let rec reduce_try3 (t:term):term = match t with
           type to emphasize the parallels with the untyped interpreter. *)
         type reduceOutcome = AlreadyReduced | ReducedTo of term
 
           type to emphasize the parallels with the untyped interpreter. *)
         type reduceOutcome = AlreadyReduced | ReducedTo of term
 
-        let reduce_if_redex (t : term) : term = match t with
+        let reduce_if_redex (t : term) : reduceOutcome = match t with
          | App(I,a) -> ReducedTo a
          | App(App(K,a),b) -> ReducedTo a
          | App(App(App(S,a),b),c) -> ReducedTo (App(App(a,c),App(b,c)))
          | App(I,a) -> ReducedTo a
          | App(App(K,a),b) -> ReducedTo a
          | App(App(App(S,a),b),c) -> ReducedTo (App(App(a,c),App(b,c)))
@@ -64,7 +64,7 @@ let rec reduce_try3 (t:term):term = match t with
 
         type reduceOutcome = AlreadyReduced | ReducedTo of term
 
 
         type reduceOutcome = AlreadyReduced | ReducedTo of term
 
-       let rec reduce_once (t : term) : term = match t with
+       let rec reduce_once (t : term) : reduceOutcome = match t with
          | App(a, b) -> (match reduce_once a with
              | ReducedTo a' -> ReducedTo (App(a',b))
              | AlreadyReduced -> (match reduce_once b with
          | App(a, b) -> (match reduce_once a with
              | ReducedTo a' -> ReducedTo (App(a',b))
              | AlreadyReduced -> (match reduce_once b with
@@ -96,7 +96,7 @@ let rec reduce_try3 (t:term):term = match t with
          | App(App(App(S,_),_),_) -> true
          | _ -> false
 
          | App(App(App(S,_),_),_) -> true
          | _ -> false
 
-       let rec reduce_head_once (t : term) : term = match t with
+       let rec reduce_head_once (t : term) : reduceOutcome = match t with
          | App(a, b) -> (match reduce_head_once a with
              | ReducedTo a' -> ReducedTo (App(a',b))
              (* now we only try to reduce b when App(a,b) is a redex *)
          | App(a, b) -> (match reduce_head_once a with
              | ReducedTo a' -> ReducedTo (App(a',b))
              (* now we only try to reduce b when App(a,b) is a redex *)