chickadee » srfi-189 » either-join

maybe-join maybeprocedure
either-join eitherprocedure

Monadic join. If maybe/either is a Just/Right whose single payload object is a Maybe/Either, returns that payload; if it is a Nothing/Left, returns maybe/either. In all other cases (including a Just/Right with multiple values) it is an error; specifically, a condition of kind (exn type payload) is raised. Thus (maybe-join (just (just x)) returns Just x and (maybe-join (just (nothing)) returns Nothing, and similarly for either-join.