Skip to content

Conversation

sivasathyaseeelan
Copy link
Contributor

@sivasathyaseeelan sivasathyaseeelan commented Jul 6, 2025

No description provided.

@bennn
Copy link
Member

bennn commented Jul 7, 2025

What does the typechecker say about this code?

The lein run results are just running it. That's good to see, but besides the point.

(examples-file-base-path ,(current-directory))
(arguments ,(list "src/typed_clojure/main.clj" "lein run -m typed-clojure.main"))
(examples-arguments ,(list "src/typed_clojure/examples.clj" "lein run -m typed-clojure.examples"))
(command "npx")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really npx ?

@bennn
Copy link
Member

bennn commented Jul 15, 2025

Siva's attempt at a command-line script (written in Clojure) to invoke the typechecker:

(ns typed-clojure.test
  (:require [typed.clojure :as t]))

(def function-names
  '[positive-success-f positive-failure-f
    negative-success-f negative-failure-f
    connectives-success-f connectives-success-g connectives-success-h
    connectives-failure-f connectives-failure-g connectives-failure-h
    nesting-body-success-f nesting-body-failure-f
    struct-fields-success-f struct-fields-failure-f
    tuple-elements-success-f tuple-elements-failure-f
    tuple-length-success-f tuple-length-failure-f
    alias-success-f alias-failure-f alias-failure-g
    nesting-condition-success-f nesting-condition-failure-f
    merge-with-union-success-f merge-with-union-failure-f
    predicate-2way-success-f predicate-2way-success-g
    predicate-2way-failure-f predicate-2way-failure-g
    predicate-1way-success-f predicate-1way-success-g
    predicate-1way-failure-f predicate-1way-failure-g
    predicate-checked-success-f predicate-checked-success-g
    predicate-checked-failure-f predicate-checked-failure-g])

(doseq [f function-names]
  (try
    (let [var-sym (symbol "typed-clojure.main" (str f))
          var-ref (resolve var-sym)]
      (if var-ref
        (do
          (t/cf var-ref)
          (println (str "Function " f " passed type checking")))
        (println (str "Function " f " failed: Could not resolve var " var-sym))))
    (catch Exception e
      (println (str "Function " f " failed: " (.getMessage e))))))
(require '[typed-clojure.main :reload :force])
(t/check-ns-clj 'typed-clojure.main :verbose-types true :verbose-forms true)
(load-file "src/typed_clojure/test.clj")

@sivasathyaseeelan sivasathyaseeelan requested a review from bennn July 27, 2025 08:36
Copy link
Member

@bennn bennn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, Typed Clojure is very impressive!

@sivasathyaseeelan sivasathyaseeelan requested a review from bennn August 4, 2025 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants