collapse namespace to monad