mirror of
https://github.com/IBM/fp-go.git
synced 2025-08-10 22:31:32 +02:00
fix: refactor either type (#102)
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@@ -196,8 +196,8 @@ func Example_getAge() {
|
||||
fmt.Println(zoltar(MakeUser("2005-12-12")))
|
||||
|
||||
// Output:
|
||||
// Right[<nil>, float64](6472)
|
||||
// Left[*time.ParseError, float64](parsing time "July 4, 2001" as "2006-01-02": cannot parse "July 4, 2001" as "2006")
|
||||
// Right[float64](6472)
|
||||
// Left[*time.ParseError](parsing time "July 4, 2001" as "2006-01-02": cannot parse "July 4, 2001" as "2006")
|
||||
// If you survive, you will be 6837
|
||||
}
|
||||
|
||||
@@ -235,8 +235,8 @@ func Example_solution08C() {
|
||||
fmt.Println(eitherWelcome(theresa08))
|
||||
|
||||
// Output:
|
||||
// Left[*errors.errorString, string](your account is not active)
|
||||
// Right[<nil>, string](Welcome Theresa)
|
||||
// Left[*errors.errorString](your account is not active)
|
||||
// Right[string](Welcome Theresa)
|
||||
}
|
||||
|
||||
func Example_solution08D() {
|
||||
@@ -269,8 +269,8 @@ func Example_solution08D() {
|
||||
fmt.Println(register(yi08)())
|
||||
|
||||
// Output:
|
||||
// Right[<nil>, string](Gary)
|
||||
// Left[*errors.errorString, <nil>](Your name Yi is larger than 3 characters)
|
||||
// Right[<nil>, string](Welcome Albert)
|
||||
// Left[*errors.errorString, string](Your name Yi is larger than 3 characters)
|
||||
// Right[string](Gary)
|
||||
// Left[*errors.errorString](Your name Yi is larger than 3 characters)
|
||||
// Right[string](Welcome Albert)
|
||||
// Left[*errors.errorString](Your name Yi is larger than 3 characters)
|
||||
}
|
||||
|
@@ -181,6 +181,6 @@ func Example_solution09C() {
|
||||
fmt.Println(joinMailingList("notanemail")())
|
||||
|
||||
// Output:
|
||||
// Right[<nil>, string](sleepy@grandpa.net)
|
||||
// Left[*errors.errorString, string](email notanemail is invalid)
|
||||
// Right[string](sleepy@grandpa.net)
|
||||
// Left[*errors.errorString](email notanemail is invalid)
|
||||
}
|
||||
|
@@ -117,7 +117,7 @@ func Example_renderPage() {
|
||||
fmt.Println(res(context.TODO())())
|
||||
|
||||
// Output:
|
||||
// Right[<nil>, string](<div>Destinations: [qui est esse], Events: [ea molestias quasi exercitationem repellat qui ipsa sit aut]</div>)
|
||||
// Right[string](<div>Destinations: [qui est esse], Events: [ea molestias quasi exercitationem repellat qui ipsa sit aut]</div>)
|
||||
|
||||
}
|
||||
|
||||
|
@@ -63,10 +63,10 @@ func Example_solution11B() {
|
||||
fmt.Println(findByNameID(4)())
|
||||
|
||||
// Output:
|
||||
// Right[<nil>, string](Albert)
|
||||
// Right[<nil>, string](Gary)
|
||||
// Right[<nil>, string](Theresa)
|
||||
// Left[*errors.errorString, string](user 4 not found)
|
||||
// Right[string](Albert)
|
||||
// Right[string](Gary)
|
||||
// Right[string](Theresa)
|
||||
// Left[*errors.errorString](user 4 not found)
|
||||
}
|
||||
|
||||
func Example_solution11C() {
|
||||
|
@@ -60,7 +60,7 @@ func Example_solution12A() {
|
||||
fmt.Println(getJsons(routes)())
|
||||
|
||||
// Output:
|
||||
// Right[<nil>, map[string]string](map[/:json for / /about:json for /about])
|
||||
// Right[map[string]string](map[/:json for / /about:json for /about])
|
||||
}
|
||||
|
||||
func Example_solution12B() {
|
||||
@@ -74,8 +74,8 @@ func Example_solution12B() {
|
||||
fmt.Println(startGame(A.From(playerAlbert, Player{Id: 4})))
|
||||
|
||||
// Output:
|
||||
// Right[<nil>, string](Game started)
|
||||
// Left[*errors.errorString, string](player 4 must have a name)
|
||||
// Right[string](Game started)
|
||||
// Left[*errors.errorString](player 4 must have a name)
|
||||
}
|
||||
|
||||
func Example_solution12C() {
|
||||
@@ -94,5 +94,5 @@ func Example_solution12C() {
|
||||
fmt.Println(readFirst())
|
||||
|
||||
// Output:
|
||||
// Right[<nil>, option.Option[string]](Some[string](content of file1 (utf-8)))
|
||||
// Right[option.Option[string]](Some[string](content of file1 (utf-8)))
|
||||
}
|
||||
|
Reference in New Issue
Block a user