 (ns epicea.typed.core
   (:require [clojure.spec :as spec]
+            [epicea.typed.lang :as lang]
             [epicea.utils.debug :as debug]
             [epicea.utils.core :as core]
             [epicea.utils.defmultiple :refer [defmultiple]]

      (core/common-error "Failed to parse " x)))
  
(assert (compilable? (parse 9)))

(defn compile-expr [argmap x cb]
  (cb argmap (access/get x expr)))


(defn try-parse-s-expr [x]
  (try
    (let [[f & r] x
          k (apply (eval f) 
                   (map parse r))]
      (if (compilable? k) k))
    (catch Throwable _ nil)))


(defn if-statement [& args] {:compilable-type :if})

;(defn dup [x]
;  (let [p (parse x)]
;    p))

(defn parse [x]
  (or (try-parse-type x)
