asString ioStr = do
str <- ioStr
return $ str
and the compiler tells me its signature is
asString :: forall (m :: * -> *) b. Monad m => m b -> m b
which, at this stage of my Haskell progress, is just pure Voodoo.
Why isn’t it’s signature asString :: IO String -> String ?
asString ioStr = str where
str <- ioStr
and then compiler says
parse error on input ‘<-’
asString ioStr = ioStr >>= (\s -> return $ s)