@@ -15,16 +15,15 @@ Either<L, R> right<L, R>(R r) => Right<L, R>(r);
1515/// Shortcut for `Either.left(l)` .
1616Either <L , R > left <L , R >(L l) => Left <L , R >(l);
1717
18- final class _EitherThrow <L > {
18+ final class _EitherThrow <L > implements Exception {
1919 final L value;
2020 const _EitherThrow (this .value);
2121}
2222
2323typedef DoAdapterEither <L > = R Function <R >(Either <L , R >);
24- DoAdapterEither <L > _doAdapter <L >() =>
25- < R > (Either <L , R > either) => either.getOrElse (
26- (l) => throw _EitherThrow (l),
27- );
24+ DoAdapterEither <L > _doAdapter <L >() => < R > (either) => either.getOrElse (
25+ (l) => throw _EitherThrow (l),
26+ );
2827
2928typedef DoFunctionEither <L , R > = R Function (DoAdapterEither <L > $);
3029
@@ -70,7 +69,7 @@ sealed class Either<L, R> extends HKT2<_EitherHKT, L, R>
7069 /// If this [Either] is [Left] , return `b` .
7170 @override
7271 C foldLeft <C >(C b, C Function (C acc, R b) f) =>
73- foldMap <Endo <C >>(dualEndoMonoid (), (b) => (C c) => f (c, b))(b);
72+ foldMap <Endo <C >>(dualEndoMonoid (), (b) => (c) => f (c, b))(b);
7473
7574 /// Use `monoid` to combine the value of [Right] applied to `f` .
7675 @override
@@ -135,8 +134,7 @@ sealed class Either<L, R> extends HKT2<_EitherHKT, L, R>
135134 /// Apply the function contained inside `a` to change the value on the [Right] from
136135 /// type `R` to a value of type `C` .
137136 @override
138- Either <L , C > ap <C >(covariant Either <L , C Function (R r)> a) =>
139- a.flatMap ((f) => map (f));
137+ Either <L , C > ap <C >(covariant Either <L , C Function (R r)> a) => a.flatMap (map);
140138
141139 /// If this [Either] is a [Right] , then return the result of calling `then` .
142140 /// Otherwise return [Left] .
@@ -311,7 +309,7 @@ sealed class Either<L, R> extends HKT2<_EitherHKT, L, R>
311309 resultList.add (e._value);
312310 } else {
313311 throw Exception (
314- " [fpdart]: Error when mapping Either, it should be either Left or Right." ,
312+ ' [fpdart]: Error when mapping Either, it should be either Left or Right.' ,
315313 );
316314 }
317315 }
@@ -383,7 +381,7 @@ sealed class Either<L, R> extends HKT2<_EitherHKT, L, R>
383381 resultListRights.add (e._value);
384382 } else {
385383 throw Exception (
386- " [fpdart]: Error when mapping Either, it should be either Left or Right." ,
384+ ' [fpdart]: Error when mapping Either, it should be either Left or Right.' ,
387385 );
388386 }
389387 }
@@ -412,7 +410,7 @@ sealed class Either<L, R> extends HKT2<_EitherHKT, L, R>
412410 /// - If [Option] is [None] , then return [Left] containing the result of `onNone`
413411 factory Either .fromOption (Option <R > m, L Function () onNone) => m.match (
414412 () => Either .left (onNone ()),
415- (r) => Either .of (r) ,
413+ Either < L , R > .of,
416414 );
417415
418416 /// If calling `predicate` with `r` returns `true` , then return `Right(r)` .
@@ -450,7 +448,11 @@ sealed class Either<L, R> extends HKT2<_EitherHKT, L, R>
450448 /// **Note**: Make sure to specify the types of [Either] (`Either<L, R>.safeCast`
451449 /// instead of `Either.safeCast` ), otherwise this will always return [Right] !
452450 factory Either .safeCast (
451+ // `dynamic`s are use for safe-casting
452+ //ignore: avoid_annotating_with_dynamic
453453 dynamic value,
454+ // `dynamic`s are use for safe-casting
455+ //ignore: avoid_annotating_with_dynamic
454456 L Function (dynamic value) onError,
455457 ) =>
456458 Either .safeCastStrict <L , R , dynamic >(value, onError);
@@ -577,7 +579,7 @@ class Right<L, R> extends Either<L, R> {
577579
578580 @override
579581 TaskEither <L , R2 > bindFuture <R2 >(Future <Either <L , R2 >> Function (R r) f) =>
580- TaskEither (() async => f (_value));
582+ TaskEither (() => f (_value));
581583
582584 @override
583585 TaskEither <L , R > toTaskEither () => TaskEither .of (_value);
0 commit comments