              [name (m-result (second code))
               [nvars expr] (annotate-expr glob-state vars (third code))
               [type num] (lookup-var vars name location)
-              res (check-types (m-result type) (m-result (get-type expr)) [nvars (with-type [:ass [:ident num] expr] (get-type expr))] location)]
+              res (check-types type (get-type expr) [nvars (with-type [:ass [:ident num] expr] (get-type expr))] location)]
              res)
       :cond (m/domonad util/phase-m
               [
                [vars1 expr] (annotate-expr glob-state vars (second code))
                [vars2 nblock] (annotate-code glob-state vars1 (third code))
-               res (check-types (m-result [:bool]) (m-result (get-type expr)) [vars2 [:cond expr nblock]] location)]
+               res (check-types [:bool] (get-type expr) [vars2 [:cond expr nblock]] location)]
               res)
       :condelse (m/domonad util/phase-m
                   [
                    [vars1 expr] (annotate-expr glob-state vars (second code))
                    [vars2 nblock1] (annotate-code glob-state vars1 (third code))
                    [vars3 nblock2] (annotate-code glob-state vars2 (fourth code))
-                   res (check-types (m-result [:bool]) (m-result (get-type expr)) [vars3 [:condelse expr nblock1 nblock2]] location)]
+                   res (check-types [:bool] (get-type expr) [vars3 [:condelse expr nblock1 nblock2]] location)]
                   res)
       :while (m/domonad util/phase-m
                [
                 [vars1 expr] (annotate-expr glob-state vars (second code))
                 [vars2 nblock] (annotate-code glob-state vars1 (third code))
-                res (check-types (m-result [:bool]) (m-result (get-type expr)) [vars2 [:while expr nblock]] location)]
+                res (check-types [:bool] (get-type expr) [vars2 [:while expr nblock]] location)]
                res
                )
       :sexp (m/domonad util/phase-m


(defn check-types
  [exp-type actual-type res location]
  (m/domonad util/phase-m
    [exp-type exp-type
     actual-type actual-type
     res (if (= actual-type exp-type)
           (util/succ res)
           (util/err (str "return type invalid; expected " (print-type exp-type) ", found " (print-type actual-type) " in " location)))
     ]
    res)

  )

(defn with-type
  [obj type]

                         (= (get-type lexpr) [:bool])
                         (= (get-type rexpr) [:bool]))
                     (util/succ [vars2 (with-type [:eand lexpr rexpr] [:bool])])
                     (util/err (str "expr invalid; expected bool,bool, found " (print-type (get-type lexpr)) ", " (print-type (get-type rexpr)) " in: " location))
                     )
               ]
              res)
