secret
Last active

  • Download Gist
logger.clj
Clojure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
(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)))
process.clj
Clojure
1 2 3 4 5 6 7 8 9 10
(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."))
repl
1 2 3 4 5 6 7 8
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=>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.