/* * Copyright 2022 Jakob Schneider Villumsen * * Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE.md file. */////// Trait for types that can be traversed from left to right with an applicative functor while filtering elements, and its functions.///pubmod Witherable {////// Trait for types that can be traversed from left to right with an applicative functor while filtering elements.///pubtraitWitherable[t: Type -> Type] withTraversable[t], Filterable[t] {////// Returns the result of applying the applicative partial mapping function `f` to all the elements of the/// data structure `t`.///pubdefwither(f: a -> m[Option[b]] \ ef, t: t[a]): m[t[b]] \ (ef + Foldable.Aef[t]) withApplicative[m] =use Functor.{<$>};use Filterable.filterMap; (identity |> filterMap) <$> Traversable.traverse(f, t)////// Returns the result of running all the actions in the data structure `t`.///pubdefsequenceWither(t: t[m[Option[a]]]): m[t[a]] \ Foldable.Aef[t] withApplicative[m] =Witherable.wither(identity, t) }}