Created
May 31, 2015 17:29
-
-
Save joerupen/efb104ea81fce9d3a77d to your computer and use it in GitHub Desktop.
This file contains 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
;; Does core.type intersection not work on values? | |
(ns user-types.demo | |
(:require [clojure.core.typed :as t])) | |
(t/defalias week-days "mon-fri" | |
(t/U (t/Val :mon) (t/Val :tue) (t/Val :wed) | |
(t/Val :thu) (t/Val :fri) )) | |
(t/defalias party-days "days with party events" | |
(t/U (t/Val :fri) (t/Val :sat))) | |
(t/defalias party-days-of-the-week "days in the week with party events" | |
(t/I week-days party-days)) | |
(t/defn party-during-week [x :- party-days-of-the-week] x) | |
;; then in repl | |
(check-ns 'user-types.demo) | |
(t/cf (u/party-during-week :wed)) | |
;; ups, no error? only friday should be allowed | |
=> [(t/I u/party-days u/week-days) {:then tt, :else ff}] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like a bug. http://dev.clojure.org/jira/browse/CTYP-225