Last active
August 29, 2015 14:16
-
-
Save jkarni/a710bf43931ad3bf6b92 to your computer and use it in GitHub Desktop.
GetWithCookie
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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