Great question! Many libraries use a monad transformer stack on top of IO rather than a direct IO interface. This can be convenient if you are also using such a stack, but it certainly complicates things a bit if you're just in IO directly.
If you follow the error messages it says that it's expecting your Monad to have an instance of MonadResource. IO does not (or else it would've just worked). This means that you'll need to find a monad transformer that provides MonadResource. By looking at the name "
Control.Monad.Trans.Resource.Internal.MonadResource" I know that I should probably start looking for something called "Control.Monad.Trans.Resource". After a bit of searching on Hackage I found http://hackage.haskell.org/package/resourcet
Something like this should compile:
{-# LANGUAGE OverloadedStrings #-}
import Network.HTTP.Client
import Instagram
import Control.Monad.Trans.Resource
code = "xxx_some_code"
credentials = Credentials "xxx_some_api_id" "xxx_some_api_secret"
main :: IO ()
main = do
manager <- newManager defaultManagerSettings
token <- runResourceT . runInstagramT credentials manager $
getUserAccessTokenURL2 redirectUrl code
print token