Let's turn to a somewhat more complicated example by defining a function getInt which insists that the user input a nonnegative integer. Such a function will be like getLine in that it will create a monadic object with a single interior object. Only in this case the monadic object will be an IO Int and the interior object will be prepared by us. Haskell's return function gives us the necessary capability. Its general type signature is
All forms of return create a monadic object whose interior objects (if any) are of the same type as their parameters.
For the IO monad the interior object of return is precisely the argument passed to it.