From b0cd872baf9dbf0638382ef4c6c988a204fb45eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Fri, 16 Feb 2018 15:43:01 +0100 Subject: [PATCH] Make NotValue more explicit --- src/CPS.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CPS.ml b/src/CPS.ml index bab67e6..9a5c0d6 100644 --- a/src/CPS.ml +++ b/src/CPS.ml @@ -3,7 +3,8 @@ module S = Lambda (* The target calculus. *) module T = Tail -exception NotValue (** <- Raised when trying to use a non-value term as such *) +exception NotValue of S.term +(** ^ Raised when trying to use a non-value term as such *) let freshId = (** Generates a fresh variable name string *) @@ -30,7 +31,7 @@ let rec cps_value (t: S.term) : T.value = match t with | S.Var v -> T.VVar v | S.Lit v -> T.VLit v | S.BinOp (l, op, r) -> T.VBinOp (cps_value l, op, cps_value r) -| S.Let _ | S.Lam _ | S.App _ | S.Print _ | S.IfZero _ -> raise NotValue +| S.Let _ | S.Lam _ | S.App _ | S.Print _ | S.IfZero _ -> raise (NotValue t) let cps_value_as_term (t: S.term) (cont: T.variable): T.term = T.TailCall(T.vvar cont, [cps_value t])