Last active
August 29, 2015 14:19
-
-
Save txus/c1e7df080f51224ab52b to your computer and use it in GitHub Desktop.
Core Typed interop
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
(ns typed.core | |
(:require [clojure.core.typed :as t])) | |
(t/ann-datatype Foo [fooName :- t/Str]) | |
(deftype Foo [fooName]) | |
(t/ann-datatype Bar [barName :- t/Str]) | |
(deftype Bar [barName]) | |
(t/ann theName [(t/U Foo Bar) -> t/Str]) | |
(defmulti theName class) | |
(defmethod theName Foo [f] (.fooName f)) | |
(defmethod theName Bar [f] (.barName f)) | |
(t/check-ns) |
Author
txus
commented
Apr 26, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment