(.module: [library [lux #* ["_" test (#+ Test)] [data ["." identity (#+ Identity)] [collection ["." list ("#\." functor mix)]]] [math ["." random] [number ["n" nat]]]]] [\\library ["." / (#+ Monad do)]]) (def: .public test Test (do random.monad [mono random.nat poly (random.list 10 random.nat)] (<| (_.covering /._) ($_ _.and (_.cover [/.do] (n.= (++ mono) (: (Identity Nat) (/.do identity.monad [sample (in mono)] (in (++ sample)))))) (_.cover [/.then] (n.= (++ mono) (: (Identity Nat) (/.then identity.monad (|>> ++ (\ identity.monad in)) (\ identity.monad in mono))))) (_.cover [/.all] (\ (list.equivalence n.equivalence) = (list\each ++ poly) (|> poly (list\each (|>> ++ (\ identity.monad in))) (: (List (Identity Nat))) (/.all identity.monad) (: (Identity (List Nat)))))) (_.cover [/.each] (\ (list.equivalence n.equivalence) = (list\each ++ poly) (|> poly (/.each identity.monad (|>> ++ (\ identity.monad in))) (: (Identity (List Nat)))))) (_.cover [/.only] (\ (list.equivalence n.equivalence) = (list.only n.even? poly) (|> poly (/.only identity.monad (|>> n.even? (\ identity.monad in))) (: (Identity (List Nat)))))) (_.cover [/.mix] (n.= (list\mix n.+ 0 poly) (|> poly (/.mix identity.monad (function (_ part whole) (\ identity.monad in (n.+ part whole))) 0) (: (Identity Nat))))) ))))