Note that there are some explanatory texts on larger screens.

plurals
  1. POhaskell model export error
    primarykey
    data
    text
    <p>Reference <a href="https://stackoverflow.com/questions/11596234/haskell-facebook-example">haskell facebook example</a> works perfect, but now I can't figure out how to split it in a separate module so I can do something useful with it. Also I can't figure out what type I need to put for fbEmail fbUrl and if I need to put OverloadedStrings in every module? Maybe my thinking process is wrong and its simple not possible to separate the import Network.HTTP.Conduit (withManager) from main?</p> <p>login.hs</p> <pre><code>{-# LANGUAGE OverloadedStrings, NoMonomorphismRestriction #-} module Login ( fbUrl, fbEmail ) where import qualified Facebook as FB import Network.HTTP.Conduit (withManager) import Data.Text import Data.ByteString.Internal (ByteString) app :: FB.Credentials app = FB.Credentials "localhost" "249348058430770" "..." url :: FB.RedirectUrl url = "http://localhost/fb" perms :: [FB.Permission] perms = ["user_about_me", "email"] fbUrl = FB.getUserAccessTokenStep1 url perms fbEmail c = withManager $ \manager -&gt; FB.runFacebookT app manager $ do t &lt;- FB.getUserAccessTokenStep2 url [c] u &lt;- FB.getUser "me" [] (Just t) return $ FB.userEmail u </code></pre> <p>main.hs</p> <pre><code>module Main ( main ) where import Login import System.IO main :: IO () main = do u &lt;- fbUrl print u a &lt;- readLn e &lt;- fbEmail a print e </code></pre> <p>I get the following error </p> <pre><code>src/Main.hs:11:10: Couldn't match expected type `IO t0' with actual type `fb-0.9.6:Facebook.Monad.FacebookT fb-0.9.6:Facebook.Monad.Auth m0 Data.Text.Internal.Text' In a stmt of a 'do' block: u &lt;- fbUrl In the expression: do { u &lt;- fbUrl; print u; a &lt;- readLn; e &lt;- fbEmail a; .... } In an equation for `main': main = do { u &lt;- fbUrl; print u; a &lt;- readLn; .... } </code></pre> <p>CODE UPDATE 6: see answer</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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