Created
April 17, 2014 03:53
-
-
Save jneen/10951752 to your computer and use it in GitHub Desktop.
core.typed and core.match failing to get along
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns type-test.lambda | |
(require [clojure.core.typed :refer :all] | |
[clojure.core.match :refer [match]])) | |
(def-alias Expr "An expression" | |
(Rec [e] | |
(U '[(Value :var) Symbol] | |
'[(Value :lam) Symbol e] | |
'[(Value :app) e e]))) | |
(ann free? (Fn [Expr Symbol -> Boolean])) | |
(defn free? [expr var] | |
(match expr | |
[:var s] (= s var) | |
[:lam arg body] (if (= arg var) false (free? body var)) | |
[:app f e] (or (free? f var) (free? e var)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Initializing core.typed ... | |
Building core.typed base environments ... | |
Finished building base environments | |
"Elapsed time: 4171.218072 msecs" | |
core.typed initialized. | |
Start collecting type-test.lambda | |
Finished collecting type-test.lambda | |
Collected 1 namespaces in 5498.927805 msecs | |
Start checking type-test.lambda | |
Type Error (type_test/lambda.clj:13:3) Cannot get index 2 from type (HVec [(Value :var) clojure.core.typed/Symbol]) | |
Type Checker: Found 1 error | |
Found errors | |
Subprocess failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment