samber / mo

🦄 Monads and popular FP abstractions, powered by Go 1.18+ Generics (Option, Result, Either...)
https://pkg.go.dev/github.com/samber/mo
MIT License
2.61k stars 85 forks source link

chore: clean Either internal state #5

Closed herulume closed 2 years ago

herulume commented 2 years ago

Currently, the Either struct uses two booleans to represent what kind of value we have. Even though mo doesn't export these booleans, they allow for 4 different states instead of the desired 2. This PR removes the isRight boolean, enforcing only two possible states can be represented internally. This change has the benefit of simplifying some tests, albeit very minimally.

samber commented 2 years ago

Definitely!

I gonna release v1.0.1