Skip to content

Instantly share code, notes, and snippets.

@jkarni
Created March 3, 2015 17:00
Show Gist options
  • Save jkarni/251a44ddae64f6556e44 to your computer and use it in GitHub Desktop.
Save jkarni/251a44ddae64f6556e44 to your computer and use it in GitHub Desktop.
Get method
-- completely untested
type MyEndpoint = "something" :> Get Int
class GetMethod a where
getMethod :: Proxy a -> String
instance GetMethod (Get x) where
getMethod _ = "GET"
-- similarly for POST, DELETE, etc.
instance GetMethod b => GetMethod (a :> b) where
getMethod _ = getMethod (Proxy b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment