diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/abstract/monad.lux | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/stdlib/source/test/lux/abstract/monad.lux b/stdlib/source/test/lux/abstract/monad.lux index cc504777c..61ee28f0e 100644 --- a/stdlib/source/test/lux/abstract/monad.lux +++ b/stdlib/source/test/lux/abstract/monad.lux @@ -10,54 +10,7 @@ ["." random]] ["_" test (#+ Test)]] {1 - ["." / (#+ Monad do)]} - [// - [functor (#+ Injection Comparison)]]) - -(def: (left-identity injection comparison (^open "_@.")) - (All [f] (-> (Injection f) (Comparison f) (Monad f) Test)) - (do {@ random.monad} - [sample random.nat - morphism (:: @ map (function (_ diff) - (|>> (n.+ diff) _@wrap)) - random.nat)] - (_.test "Left identity." - ((comparison n.=) - (|> (injection sample) (_@map morphism) _@join) - (morphism sample))))) - -(def: (right-identity injection comparison (^open "_@.")) - (All [f] (-> (Injection f) (Comparison f) (Monad f) Test)) - (do random.monad - [sample random.nat] - (_.test "Right identity." - ((comparison n.=) - (|> (injection sample) (_@map _@wrap) _@join) - (injection sample))))) - -(def: (associativity injection comparison (^open "_@.")) - (All [f] (-> (Injection f) (Comparison f) (Monad f) Test)) - (do {@ random.monad} - [sample random.nat - increase (:: @ map (function (_ diff) - (|>> (n.+ diff) _@wrap)) - random.nat) - decrease (:: @ map (function (_ diff) - (|>> (n.- diff) _@wrap)) - random.nat)] - (_.test "Associativity." - ((comparison n.=) - (|> (injection sample) (_@map increase) _@join (_@map decrease) _@join) - (|> (injection sample) (_@map (|>> increase (_@map decrease) _@join)) _@join))))) - -(def: #export (spec injection comparison monad) - (All [f] (-> (Injection f) (Comparison f) (Monad f) Test)) - (<| (_.with-cover [/.Monad]) - ($_ _.and - (..left-identity injection comparison monad) - (..right-identity injection comparison monad) - (..associativity injection comparison monad) - ))) + ["." / (#+ Monad do)]}) (def: #export test Test |