[Haskell-beginners] Monad problem

René Klačan rene.klacan at gmail.com
Sat Jul 11 12:16:36 UTC 2015


Hi all,

I've been trying to create working example with "ig"
https://hackage.haskell.org/package/ig-0.2.2 - library over instagram API
and I am facing little monad problem.

Can someone advise me please how to make this small piece of code work?

{-# LANGUAGE OverloadedStrings #-}

import Network.HTTP.Client
import Instagram

code = "xxx_some_code"
redirectUrl = "http://localhost:9988/instagram/oauth2/callback"
credentials = Credentials "xxx_some_api_id" "xxx_some_api_secret"

main :: IO ()
main = do
    manager <- newManager defaultManagerSettings
    token <- runInstagramT credentials manager $
        getUserAccessTokenURL2 redirectUrl code
    print token



I am getting following error:


src/Main.hs:14:9:
    No instance for (Control.Monad.Trans.Resource.Internal.MonadResource
                       IO)
      arising from a use of ‘getUserAccessTokenURL2’
    In the second argument of ‘($)’, namely
      ‘getUserAccessTokenURL2 redirectUrl code’
    In a stmt of a 'do' block:
      token <- runInstagramT credentials manager
               $ getUserAccessTokenURL2 redirectUrl code
    In the expression:
      do { manager <- newManager defaultManagerSettings;
           token <- runInstagramT credentials manager
                    $ getUserAccessTokenURL2 redirectUrl code;
           print token }



Thanks

Rene
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150711/568e3af1/attachment.html>


More information about the Beginners mailing list