Skip to content

Instantly share code, notes, and snippets.

@Janiczek
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Janiczek/e9c74130f18dd17c6d11 to your computer and use it in GitHub Desktop.
Save Janiczek/e9c74130f18dd17c6d11 to your computer and use it in GitHub Desktop.
(ns untitled.core
(:require [schema.core :as s]
[schema.macros :as sm]))
(def Length s/Int)
(def Count s/Int)
(sm/defn add-lengths :- Length
[a :- Length
b :- Length]
(+ a b))
(sm/def a-length :- Length 1)
(sm/def a-count :- Count 2)
(sm/with-fn-validation
(add-lengths a-length a-length) ;; okay
(add-lengths a-length a-count) ;; <---------- I want this to crash
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment