Consider this Swift:
let addr: String? = person?.job?.address
In this case, if person is nil, it returns nil, otherwise it bind
s the job
, and repeats.
This same thing is expressed in Haskell as:
addrOf person = person >>= (\p -> ((job p) >>= (\job -> (address job))))
Or the much less unwieldy:
addrOf person = do
p <- person
j <- job person
return $ address j