https://github.com/gertcuykens/haskell-designの完全なコード
application :: MVar ServerState -> WS.Request -> WS.WebSockets WS.Hybi10 ()
application state rq = do
--snip--
let a = ("code","test")
e <- fbEmail $ (\(x,y) -> (C.pack x, C.pack y)) a
私にエラーを与える
src/Server.hs:60:10:
No instances for (resourcet-0.3.2.2:Control.Monad.Trans.Resource.MonadThrow
(WS.WebSockets WS.Hybi10),
resourcet-0.3.2.2:Control.Monad.Trans.Resource.MonadUnsafeIO
(WS.WebSockets WS.Hybi10),
monad-control-0.3.1.3:Control.Monad.Trans.Control.MonadBaseControl
IO (WS.WebSockets WS.Hybi10))
arising from a use of `fbEmail'
Possible fix:
add instance declarations for
(resourcet-0.3.2.2:Control.Monad.Trans.Resource.MonadThrow
(WS.WebSockets WS.Hybi10),
resourcet-0.3.2.2:Control.Monad.Trans.Resource.MonadUnsafeIO
(WS.WebSockets WS.Hybi10),
monad-control-0.3.1.3:Control.Monad.Trans.Control.MonadBaseControl
IO (WS.WebSockets WS.Hybi10))
In the expression: fbEmail
In a stmt of a 'do' block:
e <- fbEmail $ (\ (x, y) -> (C.pack x, C.pack y)) a
In the expression:
do { WS.acceptRequest rq;
WS.getVersion >>= liftIO . putStrLn . ("Client version: " ++);
sink <- WS.getSink;
msg <- WS.receiveData;
.... }
私が最終的に達成したいのは交換です
let prefix = "Facebook code"
let client = (T.drop (T.length prefix) msg, sink)
のようなもので
let prefix = "Facebook code"
let code = T.drop (T.length prefix) msg
client = (fbEmail code, sink)