diff --git a/src/func/instances/future.rs b/src/func/instances/future.rs index d0e5095..27cc459 100644 --- a/src/func/instances/future.rs +++ b/src/func/instances/future.rs @@ -136,3 +136,35 @@ impl<'a> SharedFunctor<'a> for FutureInstance { Box::pin(sa) } } + +#[cfg(test)] +mod future_tests { + use super::{test_suite, tests, FutureInstance}; + + type T = FutureInstance; + + impl<'a> tests::Eqr<'a> for T { + fn eqr( + name: &'a str, + left: Self::F, + right: Self::F, + ) -> tests::R { + tests::eqr( + name, + futures::executor::block_on(left), + futures::executor::block_on(right), + ) + } + } + + impl<'a> test_suite::FunctorTestSuite<'a> for T { + fn sample Self::F))>(mut f: F) { + f(&|a| Box::pin(futures::future::ready(a))); + } + } + + #[test] + fn monad_follows_laws() { + test_suite::monad_follows_laws::().unwrap(); + } +}