-
-
Save mybuddymichael/065c7f8090aa19efd82f 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 pgbot.logger | |
(:require (pgbot [process :refer [PProcess]] | |
[messages :refer [compose]]) | |
[clojure.core.typed :as t] | |
[clojure.core.typed.async :refer [Chan chan> go>]] | |
[clojure.core.async :refer [alts! go <! close!]])) | |
(t/ann-record Logger [in := Chan | |
out-listener := Chan | |
stop := Chan]) | |
(defrecord Logger [in out-listener stop] | |
PProcess | |
(start [{:keys [in out-listener stop] :as logger}] | |
logger) | |
(stop [{:keys [stop] :as logger}] | |
logger)) | |
(defn ->Logger [] | |
(Logger. (chan> pgbot.messages.Message) | |
(chan> pgbot.messages.Message) | |
(chan> Any))) |
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 pgbot.process | |
(:require [clojure.core.typed :as t])) | |
(t/ann-protocol PProcess | |
start [PProcess -> PProcess] | |
start [PProcess -> PProcess]) | |
(t/defprotocol> PProcess | |
"A protocol for starting and stopping processes." | |
(start [system] "Runs side effects to start the process. Returns the process.") | |
(stop [system] "Runs side effects to stop the process. Returns the process.")) |
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
user=> (clojure.core.typed/check-ns 'pgbot.logger) | |
WARNING: Assuming unannotated var clojure.core.typed.async/Chan is a protocol. | |
WARNING: Assuming unannotated var clojure.core.typed.async/Chan is a protocol. | |
WARNING: Assuming unannotated var clojure.core.typed.async/Chan is a protocol. | |
10: Not checking pgbot.messages/->Message definition | |
AssertionError Assert failed: (instance? clojure.reflect.Method method-sig) clojure.core.typed.check/eval23466/check deftype*--23469/fn--23472/fn--23497/fn--23524 (check.clj:4297) | |
user=> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment