fn: breaking - polish Either API
This commit is contained in:
3 files changed
+13
-13
No files matched your search
+6
-6
@@ -10,17 +10,17 @@ func TestPropConstructorEliminatorDuality(t *testing.T) {
|
||||
Len := func(s string) int { return len(s) } // smh
|
||||
if isRight {
|
||||
v := ElimEither(
|
||||
NewRight[int, string](s),
|
||||
Iden[int],
|
||||
Len,
|
||||
NewRight[int, string](s),
|
||||
)
|
||||
return v == Len(s)
|
||||
}
|
||||
|
||||
v := ElimEither(
|
||||
NewLeft[int, string](i),
|
||||
Iden[int],
|
||||
Len,
|
||||
NewLeft[int, string](i),
|
||||
)
|
||||
return v == i
|
||||
}
|
||||
@@ -99,16 +99,16 @@ func TestPropToOptionIdentities(t *testing.T) {
|
||||
if isRight {
|
||||
e = NewRight[int, string](s)
|
||||
|
||||
r2O := e.RightToOption() == Some(s)
|
||||
r2O := e.RightToSome() == Some(s)
|
||||
o2R := e == OptionToRight(Some(s), i)
|
||||
l2O := e.LeftToOption() == None[int]()
|
||||
l2O := e.LeftToSome() == None[int]()
|
||||
|
||||
return r2O && o2R && l2O
|
||||
} else {
|
||||
e = NewLeft[int, string](i)
|
||||
l2O := e.LeftToOption() == Some(i)
|
||||
l2O := e.LeftToSome() == Some(i)
|
||||
o2L := e == OptionToLeft(Some(i), s)
|
||||
r2O := e.RightToOption() == None[string]()
|
||||
r2O := e.RightToSome() == None[string]()
|
||||
|
||||
return l2O && o2L && r2O
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user