Implementation of haskell inspired Data.Maybe functions