Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.typed by

https://gist.github.com/joerupen/efb104ea81fce9d3a77d

`

;; 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}]
`

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CTYP-225 (reported by ambrosebs)
...