Hatena::Grouphaskell

suztomoの日記

 | 

2012-02-05

because type variable `s' would escape its scope

00:15

Yesod.Auth.OAuthをいじくってGoogle PlusのOAuth2.0を使ってみようとしたら謎なエラーめっせーじ。

GooglePlusOAuth.hs:44:54:
    Couldn't match type `sub0' with `s'
      because type variable `s' would escape its scope
    This (rigid, skolem) type variable is bound by
      a type expected by the context:
        (Route Auth -> Route m) -> GWidget s m ()
    The following variables have types that mention sub0
      login :: (AuthRoute -> Route m)
               -> GGWidget
                    m
                    (Control.Monad.Trans.Reader.ReaderT
                       (HandlerData sub0 m)
                       (enumerator-0.4.16:Data.Enumerator.Internal.Iteratee
                          ByteString ghc-prim:GHC.Types.IO))
                    ()
        (bound at GooglePlusOAuth.hs:70:5)
    In the third argument of `AuthPlugin', namely `login'
    In the expression: AuthPlugin name dispatch login
    In an equation for `authOAuth':
        authOAuth name ident reqUrl accUrl authUrl key sec
          = AuthPlugin name dispatch login
          where
              url = PluginR name []
              oauth
                = OAuth
                    {oauthServerName = unpack name, oauthRequestUri = reqUrl,
                     oauthAccessTokenUri = accUrl, oauthAuthorizeUri = authUrl,
                     oauthSignatureMethod = HMACSHA1, oauthConsumerKey = fromString key,
                     oauthConsumerSecret = fromString sec, oauthCallback = Nothing}
              dispatch "GET" ["forward"]
                = do { render <- getUrlRender;
                       .... }
              dispatch "GET" []
                = do { (verifier, oaTok) <- runInputGet
                                          $     (,) <$> ireq textField "oauth_verifier"
                                            <*>
                                              ireq textField "oauth_token";
                       .... }
              dispatch _ _ = notFound
              login tm
                = do { render <- lift getUrlRender;
                       .... }

 |