Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First, let me preface this answer by the disclaimer that I've never actually used the Facebook API or the <code>Conduits</code> library, so I'm not sure if this code actually does anything sensible, but by going with just the type information, I think this is what you were trying to do</p> <pre><code>main :: IO () main = withManager $ \manager -&gt; FB.runFacebookT app manager $ do fbAuthUrl &lt;- FB.getUserAccessTokenStep1 url perms liftIO $ print fbAuthUrl argument &lt;- liftIO $ readLn token &lt;- FB.getUserAccessTokenStep2 url [argument] u &lt;- FB.getUser "me" [] (Just token) liftIO $ print (FB.userEmail u) </code></pre> <p>The main pitfall is that <code>main</code> in Haskell must <em>always</em> have the type <code>IO a</code>, but you are trying to use a value of type <code>FacebookT Auth m ()</code> as your <code>main</code>. Your implementation is on the right track, but the <code>runFacebookT</code> and <code>withManager</code> need to be the first thing in the function.</p> <p>Type-wise, the actual do-block has the type <code>FacebookT Auth (ResourceT IO) ()</code>. The <code>runFacebookT</code> function is used to unwrap the <code>FacebookT</code> transformer, resulting in a <code>ResourceT IO ()</code> value, which is in turn processed by <code>withManager</code> to produce a plain old <code>IO ()</code>.</p> <p>One additional problem was that you originally had a <code>readLn</code> in your do-block without <code>liftIO</code>, which was confusing the type-inference. I also added the missing <code>Just</code> to the <code>FB.getUser</code> call.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload