One or the other.
Treat the values from the First and Second case equally
[ Or.First 0, Or.Second 1 ] |> List.map Or.value
--> [ 0, 1 ]In case it's the First, change it based on it's current value
Or.First "hello" |> Or.onFirstMap String.toUpper
--> Or.First "HELLO"
Or.Second "hello" |> Or.onFirstMap String.toUpper
--> Or.Second "hello"Prefer a case..of if you handle both cases
In case it's the Second, change it based on it's current value
Or.First "hello" |> Or.onSecondMap String.toUpper
--> Or.First "hello"
Or.Second "hello" |> Or.onSecondMap String.toUpper
--> Or.Second "HELLO"Prefer a case..of if you handle both cases
Just if the first value is present, Nothing if the second is present
Or.First 0 |> Or.justOnFirst --> Just 0
Or.Second 1 |> Or.justOnFirst --> NothingPrefer a case..of if you handle both cases
Just if the second value is present, Nothing if the first is present
Or.First 0 |> Or.justOnSecond --> Nothing
Or.Second 1 |> Or.justOnSecond --> Just 1Prefer a case..of if you handle both cases
One or the other.
When (not) to use this? → readme