(.module: lux (lux/control [order])) ## [Signatures] (sig: #export (Enum e) {#.doc "Enumerable types, with a notion of moving forward and backwards through a type's instances."} (: (order.Order e) order) (: (-> e e) succ) (: (-> e e) pred)) ## [Functions] (def: (range' <= succ from to) (All [a] (-> (-> a a Bool) (-> a a) a a (List a))) (if (<= to from) (#.Cons from (range' <= succ (succ from) to)) #.Nil)) (def: #export (range (^open) from to) {#.doc "An inclusive [from, to] range of values."} (All [a] (-> (Enum a) a a (List a))) (range' <= succ from to))