Extracting nested monadic result: m (m a) -> m a
问题 I have a function parseArgs :: [String] -> StdGen -> IO () which selects the function to run. The main looks like main = parseArgs <$> getArgs <*> getStdGen >>= id The problem I have, parseArgs <$> getArgs <*> getStdGen is of type IO (IO ()) , which I extract using (>>= id) which is of type Monad m => m (m b) -> m b . Is there a way to avoid requiring the "extraction" of the value while having just a single line function? 回答1: The easiest way would be with join : main = join $ parseArgs <$>