Skip to content

Instantly share code, notes, and snippets.

@codedmart
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save codedmart/c965ca9cbd158802bfc8 to your computer and use it in GitHub Desktop.

Select an option

Save codedmart/c965ca9cbd158802bfc8 to your computer and use it in GitHub Desktop.
Api/Main.hs:76:10:
Couldn't match type ‘Application’
with ‘(UserSignup
-> ReaderT AppConfig (EitherT ServantErr IO) SecureUser)
:<|> ((Text
-> UserEdit
-> ReaderT AppConfig (EitherT ServantErr IO) SecureUser)
:<|> (Text -> ReaderT AppConfig (EitherT ServantErr IO) ()))’
Expected type: (ReaderT
AppConfig (EitherT ServantErr IO) [SecureUser]
:<|> ((UserSignup
-> ReaderT AppConfig (EitherT ServantErr IO) SecureUser)
:<|> ((Text
-> UserEdit
-> ReaderT AppConfig (EitherT ServantErr IO) SecureUser)
:<|> (Text -> ReaderT AppConfig (EitherT ServantErr IO) ()))))
:<|> Application
Actual type: ServerT UsersAPI AppIO
In the second argument of ‘(:<|>)’, namely ‘usersServer’
In the expression: do { getApiInfo } :<|> usersServer
Api/Main.hs:98:14:
Couldn't match type ‘ret1 :<|> ret2’
with ‘EitherT ServantErr IO ApiInfo’
arising from a functional dependency between:
constraint ‘Servant.Server.Internal.Enter.Enter
(ReaderT AppConfig (EitherT ServantErr IO) ApiInfo
:<|> ((ReaderT AppConfig (EitherT ServantErr IO) [SecureUser]
:<|> ((UserSignup
-> ReaderT AppConfig (EitherT ServantErr IO) SecureUser)
:<|> ((Text
-> UserEdit
-> ReaderT AppConfig (EitherT ServantErr IO) SecureUser)
:<|> (Text
-> ReaderT AppConfig (EitherT ServantErr IO) ()))))
:<|> Application))
(AppIO :~> EitherT ServantErr IO)
(EitherT ServantErr IO ApiInfo)’
arising from a use of ‘enter’
instance ‘Servant.Server.Internal.Enter.Enter
(typ1 :<|> typ2) arg1 (ret3 :<|> ret4)’
at <no location info>
In the first argument of ‘(:<|>)’, namely
‘enter (appIOToEither t) serverT’
In the expression:
enter (appIOToEither t) serverT :<|> socketIOHandler h
In an equation for ‘server’:
server t h = enter (appIOToEither t) serverT :<|> socketIOHandler h
Api/Main.hs:98:14:
Couldn't match type ‘Request
-> (Response -> IO ResponseReceived) -> IO ResponseReceived’
with ‘(EitherT ServantErr IO [SecureUser]
:<|> ((UserSignup -> EitherT ServantErr IO SecureUser)
:<|> ((Text -> UserEdit -> EitherT ServantErr IO SecureUser)
:<|> (Text -> EitherT ServantErr IO ()))))
:<|> Application’
Expected type: Server API
Actual type: EitherT ServantErr IO ApiInfo
:<|> (Request
-> (Response -> IO ResponseReceived) -> IO ResponseReceived)
In the expression:
enter (appIOToEither t) serverT :<|> socketIOHandler h
In an equation for ‘server’:
server t h = enter (appIOToEither t) serverT :<|> socketIOHandler h
type API =
Get ApiInfo
:<|> "users" :> UsersAPI
:<|> "socket.io" :> Raw
serverT :: ServerT API AppIO
serverT = do
getApiInfo
:<|> usersServer
where
getApiInfo :: AppIO ApiInfo
getApiInfo = apiInfo
{-socketIOHandler ::-}
socketIOHandler h req respond = do
t <- toWaiApplication h req respond
return t
appIOToEither' :: AppConfig -> AppIO a -> EitherT ServantErr IO a
appIOToEither' t r = runReaderT (hoist (EitherT . runEitherT) r) t
appIOToEither :: AppConfig -> AppIO :~> EitherT ServantErr IO
appIOToEither t = Nat $ appIOToEither' t
api :: Proxy API
api = Proxy
server :: AppConfig -> WaiMonad () -> Server API
server t h = enter (appIOToEither t) serverT :<|> socketIOHandler h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment