(.module: [lux #* [control [monoid (#+ Monoid)]]]) (def: #export (compose f g) {#.doc "Function composition."} (All [a b c] (-> (-> b c) (-> a b) (-> a c))) (|>> g f)) (def: #export (constant value) {#.doc "Create constant functions."} (All [o] (-> o (All [i] (-> i o)))) (function (_ _) value)) (def: #export (flip f) {#.doc "Flips the order of the arguments of a function."} (All [a b c] (-> (-> a b c) (-> b a c))) (function (_ x y) (f y x))) (structure: #export Monoid (All [a] (Monoid (-> a a))) (def: identity id) (def: compose ..compose))