Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No instance for (resourcet-1.1.6:Control.Monad.Trans.Resource.Internal.MonadResource IO) #232

Closed
joehillen opened this issue Oct 7, 2015 · 4 comments

Comments

@joehillen
Copy link
Contributor

main = do
  e <- newEnv Oregon Discover
  runAWS e $ send describeInstances
  return ()

gives this error:

    No instance for (resourcet-1.1.6:Control.Monad.Trans.Resource.Internal.MonadResource
                       IO)
      arising from a use of ‘runAWS’
    In the expression: runAWS e
    In a stmt of a 'do' block: runAWS e $ void $ send describeInstances
    In the expression:
      do { e <- newEnv Oregon Discover;
           runAWS e $ void $ send describeInstances;
           return () }

Not a very helpful error message. I can't figure out what is wrong.

@brendanhay
Copy link
Owner

The result of runAWS is MonadResource m => m a, which needs to be further unwrapped (m a -> IO a) using runResourceT. This is exported by Network.AWS and should be available in scope.

For example:

runResourceT . runAWS e $ do
    ...

@brendanhay
Copy link
Owner

I'll close this for now. If you have more questions feel free to re-open or create a new issue, you can also use the Gitter chat.

@joehillen
Copy link
Contributor Author

My confusion came from the example at the top of that page uses runAWS in IO. https://hackage.haskell.org/package/amazonka-1.3.2.1/docs/Network-AWS.html#g:1

@brendanhay
Copy link
Owner

Thanks, I'll fix the docs

joehillen added a commit to joehillen/amazonka that referenced this issue Oct 7, 2015
The usage example seems to be wrong. It caused the confusion in brendanhay#232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants