Skip to content

Instantly share code, notes, and snippets.

@jkarni
Last active August 29, 2015 14:16
Show Gist options
  • Save jkarni/a710bf43931ad3bf6b92 to your computer and use it in GitHub Desktop.
Save jkarni/a710bf43931ad3bf6b92 to your computer and use it in GitHub Desktop.
GetWithCookie
data GetWithCookie (a :: *)
type Short a = EitherT (Int,String) IO a
instance HasServer (GetWithCookie a) where
type Server (GetWithCookie a) = EitherT (Int,String) IO (a, ByteString) -- the ByteString is the cookie
route Proxy action request respond = do
e <- runEitherT (action)
respond . succeedWith $ case e of
Right (output, bs) -> responseLBS undefined {- put the header in -}
--- And then "type MyAPI = "home" :> GetWithCookie Int" and a handler that returns a tuple with the bytestring
--- (or AuthResult)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment