1
0
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:
Carsten Leue
2024-02-07 11:03:20 +01:00
committed by GitHub
parent 7daf65effc
commit 8150ae2a68
18 changed files with 59 additions and 58 deletions

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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>)
}

View File

@@ -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() {

View File

@@ -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)))
}