use std::marker::PhantomData; use either::Either; use metatrait::{ base::functor::*, existence::{Never, Sometimes}, }; struct Phantoms; impl BaseUnwrap> for Phantoms { type T = T; } impl BaseWrap for Phantoms { type Wrap = PhantomData; } impl BasePure for Phantoms { fn pure(_: T) -> Self::Wrap { PhantomData } } impl BaseMap for Phantoms { fn map(_: Self::Wrap, _: impl FnOnce(In) -> Out) -> Self::Wrap { PhantomData } } impl BaseMap2 for Phantoms { fn map2( _: Self::Wrap, _: Self::Wrap, _: impl FnOnce(In0, In1) -> Out, ) -> Self::Wrap { PhantomData } } impl BaseSelect for Phantoms { fn select(_: Self::Wrap, _: Self::Wrap) -> BaseSelectWrap { PhantomData } } impl BaseFlatten for Phantoms { fn flatten(_: Self::Wrap>) -> Self::Wrap { PhantomData } } impl BaseToEither for Phantoms { type L = Never; type R = Sometimes; fn either(_: Self::Wrap) -> Either<(In, Self::L), (Self::Wrap, Self::R)> { Either::Right((PhantomData, Sometimes)) } } fn main() {}