 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Compilable
 
-(defn compile-expr [argmap expr cb]
-  (cb argmap [:compiled expr]))
+(defn expr-access [i]
+  (access/vector-accessor i {:default-parent [nil nil]}))
+(def expr-type (expr-access 0))
+(def expr-value (expr-access 1))
+
+(defmultiple compile-expr (fn [argmap expr cb]
+                            (access/getx expr-type expr))
+  (:default 
+   [argmap expr cb]
+   (cb argmap {:type (spec/conform ::type (access/getx expr-value expr))
+               :repr expr})))
 
 (def empty-argmap {})
+
+
+(defn value? [x]
+  (and (map? x)
+       (contains? x :type)
+       (contains? x :repr)))
+
+(defn check-is-value [x]
+  (if (not (value? x))
+    (throw (RuntimeException. 
+            (str "Invalid value: " x)))))
 
 (defn compile-exprs [argmap exprs cb]
   (cond

    (empty? (rest exprs)) (compile-expr argmap (first exprs) cb)
    :default (compile-expr 
              argmap (first exprs)
              (fn [new-argmap _]
                (compile-exprs new-argmap (rest exprs) cb)))))

(defmacro with-typed [& args]
  (let [parsed (spec/conform ::exprs args)]

              (str "Failed to parsed typed: " 
                   (spec/explain-str ::exprs args))))
      (compile-exprs empty-argmap parsed (fn [final-argmap final-value]
                                           (check-is-value final-value)
                                           (export-typed-value final-value))))))
  
  
(macroexpand '(with-typed 9 4 5 6))
