concrete functor and monad transformers
#39return of nested MaybeT takes exponential time
return
of MaybeT m
calls return
of m
twice (including once through lift
), which leads to an exponential asymptotic complexity.
See description in http://stackoverflow.com/questions/43149878/why-do-nested-maybets-cause-exponential-allocation/43151568#43151568
The following would fix it, and is much simpler in other respects.
return = MaybeT . return . Just