You can wrap values into actions and pipe the result of one computation into another:
return :: Monad m => a -> m a
(>>=) :: Monad m => m a -> (a -> m b) -> m b
However, the definition of a Monad doesn’t guarantee the existence of a function of type Monad m => m a -> a
.
That means there is, in general, no way to extract a value from a computation (i.e. “unwrap” it). This is the case for many instances:
extract :: Maybe a -> a
extract (Just x) = x -- Sure, this works, but...
extract Nothing = undefined -- We can’t extract a value from failure.
Specifically, there is no function IO a -> a
, which often confuses beginners; see this example.