-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change passCase/failCase name to OK/Failure
- Loading branch information
1 parent
f9fe932
commit 7259926
Showing
5 changed files
with
21 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 8 additions & 8 deletions
16
apps/mobile/packages/ddd_core/lib/src/ok_fail_test_results.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import 'package:dartz/dartz.dart'; | ||
|
||
class Fail<L, R> extends Either<L, R> { | ||
class Failure<L, R> extends Either<L, R> { | ||
final L _l; | ||
const Fail(this._l); | ||
const Failure(this._l); | ||
L get value => _l; | ||
@override | ||
B fold<B>(B ifLeft(L l), B ifRight(R r)) => ifLeft(_l); | ||
@override | ||
bool operator ==(other) => other is Fail && other._l == _l; | ||
bool operator ==(other) => other is Failure && other._l == _l; | ||
@override | ||
int get hashCode => _l.hashCode; | ||
} | ||
|
||
class OK<L, R> extends Either<L, R> { | ||
class OKE<L, R> extends Either<L, R> { | ||
final R _r; | ||
const OK(this._r); | ||
const OKE(this._r); | ||
R get value => _r; | ||
@override | ||
B fold<B>(B ifLeft(L l), B ifRight(R r)) => ifRight(_r); | ||
@override | ||
bool operator ==(other) => other is OK && other._r == _r; | ||
bool operator ==(other) => other is OKE && other._r == _r; | ||
@override | ||
int get hashCode => _r.hashCode; | ||
} | ||
|
||
Either<L, R> passCase<L, R>(R r) => new OK(r); | ||
Either<L, R> failCase<L, R>(L l) => new Fail(l); | ||
Either<L, R> OK<L, R>(R r) => new OKE(r); | ||
Either<L, R> failure<L, R>(L l) => new Failure(l); |