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?
The easiest way would be with
join
:Personally, I would prefer the form
where
Or just use a do