chickadee » srfi-189 » maybe-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. Thus (maybe-join (just (just x)) returns Just x and (maybe-join (just (nothing)) returns Nothing, and similarly for either-join.