Skip to content
Newer
Older
100644 31 lines (27 sloc) 1 KB
6b5231a @frenchy64 Doc on hole driven development
frenchy64 authored Aug 14, 2013
1 (ns
2 ^{:see-also [["http://matthew.brecknell.net/post/hole-driven-haskell/" "Hole Driven Development"]]
3 :doc "This namespace contains easy tools for hole driven development"}
4 clojure.core.typed.hole
1e09597 @frenchy64 Add global annotations at runtime on evaluation
frenchy64 authored Dec 30, 2013
5 (:require [clojure.core.typed :refer [ann ann-datatype] :as t]))
5769b2d @frenchy64 Add hole namespace
frenchy64 authored May 3, 2013
6
1e09597 @frenchy64 Add global annotations at runtime on evaluation
frenchy64 authored Dec 29, 2013
7 (binding [t/*collect-on-eval* false]
8 (ann silent-hole [-> Nothing]))
5769b2d @frenchy64 Add hole namespace
frenchy64 authored May 3, 2013
9 (defn silent-hole
10 "A silent hole. (silent-hole) passes for any other type
11 when type checking.
12 Use (silent-hole) as a placeholder for code.
13 Throws an exception when evaluted."
14 []
15 (throw (Exception. "silent hole")))
16
1e09597 @frenchy64 Add global annotations at runtime on evaluation
frenchy64 authored Dec 29, 2013
17 (binding [t/*collect-on-eval* false]
18 (ann-datatype NoisyHole []))
5769b2d @frenchy64 Add hole namespace
frenchy64 authored May 3, 2013
19 (deftype NoisyHole [])
20
1e09597 @frenchy64 Add global annotations at runtime on evaluation
frenchy64 authored Dec 29, 2013
21 (binding [t/*collect-on-eval* false]
22 (ann noisy-hole [-> NoisyHole]))
5769b2d @frenchy64 Add hole namespace
frenchy64 authored May 3, 2013
23 (defn noisy-hole
24 "A noisy hole. The type system will complain when
25 (noisy-hole) is used in positions that expect a type
26 more specific than Object or Any.
27 Use (noisy-hole) as a placeholder for code.
28 Throws an exception when evaluted."
29 []
30 (throw (Exception. "noisy hole")))
Something went wrong with that request. Please try again.