Monadic transformation on types