because type variable `s' would escape its scope - suztomoの日記 - haskellがとりあえず解けた
Type declarationをしたら動いた。
login :: forall s m. (Route Auth -> Route m) -> GWidget s m ()
login tm = do
render <- lift getUrlRender
let oaUrl = render $ tm $ oauthUrl name
addHtml $
[shamlet| <a href=#{oaUrl}>Login with #{name} |]
参考にしたページ。
Haskell - Haskell-Cafe - Enabling GADTs breaks Rank2Types code compilation - Why?
Rank2 Type
第20回 更新を高速化するためのSTモナド - 本物のプログラマはHaskellを使う:ITpro
7.8.?Other type system extensions
{-# LANGUAGE Rank2Types #-} applyTuple :: (forall a. a -> a) -> (Bool, String) applyTuple f = (f True, f "hidamari") applyTuple2 :: forall a. (a -> a) -> (Bool, String) applyTuple2 f = (f True, f "hidamari")
一つ目はfに(Bool -> Bool)がきてもいいし、(String -> String)がきてもいいということ。二つ目は(f True)の時点でaの型が(Bool -> Bool)に固定され、(f "hidamari")の片付け(unification)に失敗する。