Created
May 22, 2014 17:39
-
-
Save frenchy64/076d25450eed8f80aabe 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
(ns typed-demo.protocol | |
(:require [clojure.core.typed :as tc]) | |
(:import (java.util Random))) | |
(tc/defprotocol IRandom | |
(-next-int | |
[this limit :- Integer] :- Integer)) | |
(tc/ann-record SeededRandom [seed :- tc/AnyInteger | |
rng :- java.util.Random]) | |
(defrecord SeededRandom [seed ^java.util.Random rng] | |
IRandom | |
(-next-int | |
[this limit] | |
(tc/ann-form limit Integer) | |
;Local binding limit__#0 expected type java.lang.Integer, but actual type Object | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment