I hereby claim:
- I am c-spencer on github.
- I am cagspencer (https://keybase.io/cagspencer) on keybase.
- I have a public key whose fingerprint is 6941 F445 2599 B7BC FF92 F7B1 E091 D260 3D41 E23C
To claim this, I am signing this object:
pub fn access_token() -> BoxedFilter<(String,)> { | |
let (set_token_value, token_value) = | |
tokio_sync::watch::channel::<Option<gcloud::GrantedToken>>(None); | |
let channel_lock = tokio_sync::lock::Lock::new(set_token_value); | |
warp::any() | |
.and_then(move || { | |
let current_value = token_value.get_ref().clone().filter(|t| t.is_valid()); | |
let result = match current_value { |
I hereby claim:
To claim this, I am signing this object:
(ns typed-datomic.types | |
(:use [clojure.core.typed]) | |
(:import [clojure.lang Keyword Symbol] | |
[java.util Date])) | |
;; Type aliases | |
; Marker protocol to distinguish historical databases | |
(ann-protocol HistoryDB) | |
(defprotocol> HistoryDB) |
; adapted from clojure.core.incubator | |
(defn dissoc-in | |
"Dissociates a number of entries from the object at the given path, | |
removing empty maps on the path. | |
e.g. (dissoc-in {:a {:b {:e 6} :c 6}} [:a :b] [:e]) -> {:a {:c 6}}" | |
[m [k & ks :as keys] rems] | |
(if k | |
(if-let [nextmap (get m k)] | |
(let [newmap (dissoc-in nextmap ks rems)] | |
(if (seq newmap) |
(cf (fn [m] (conj [0] (if m 1 2)))) | |
; [(Fn [Any -> [(Value 0) (U (Value 1) (Value 2))]]) {:then tt, :else ff}] | |
(cf (fn [{:keys [a] :as m} c] | |
(merge m {:b (+ a c) :c c})) | |
['{:a Number} Number -> '{:a Number :b Number :c Number}]) | |
; (Fn [(HMap :mandatory {:a Number}) Number -> (HMap :mandatory {:a Number, :b Number, :c Number})]) | |
(cf (fn [m] (dissoc {:a 1 :b 2} (if m :a :b)))) | |
; [(Fn [Any -> (U (HMap :mandatory {:a (Value 1)} :complete? true) |
(defn create-type | |
"Extract a type from provided field idents stored in Datomic database at uri." | |
[uri type-name overrides] | |
(let [c (d/connect uri) | |
d (d/db c) | |
datomic-type-map {:db.type/string 'String | |
:db.type/ref 'Any} | |
mt (dt/q> :- [EntityID] | |
'[:find ?e | |
:in $ ?t-name |
; trying to work around no update-in type | |
(defmacro typed-update-in [m [v] f] | |
`((ann-form update-in | |
(~'All [~'x ~'y] | |
[ (~'HMap :mandatory {~v ~'x}) (~'Vector* Keyword) [~'x ~'-> ~'y] | |
~'-> | |
(~'HMap :mandatory {~v ~'y}) ])) | |
~m [~v] ~f)) | |
; still causes an error because of the inner un-typed update-in |
(defn Buffer [string] | |
(set! this.string string) | |
(set! this.pos 0) | |
undefined) | |
(defn Buffer.prototype.read1 [] | |
(cond | |
(= this.pos this.string.length) | |
(do | |
(set! this.pos (+ this.pos 1)) |
(ns typingfun.core | |
(:require [clojure.core.typed :as t])) | |
(t/ann-protocol AddProtoc | |
adder [AddProtoc Number -> AddProtoc]) | |
(t/defprotocol> AddProtoc | |
(adder [this amount])) | |
(t/ann-datatype Accumulator [t :- Number]) |
(defn extract-key [m k] | |
(when-let [value (k m)] [(dissoc m k) value])) | |
(defn expand-entry-id [entry] | |
(if (keyword? (:db/id entry)) | |
(update-in entry [:db/id] d/tempid) | |
entry)) | |
(defn expand-schema-entry [entry templates] | |
(if (and (map? entry) (:meta/templates entry)) |