Skip to content

Instantly share code, notes, and snippets.

@alpmestan
Created December 31, 2014 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alpmestan/5209f1efde0e17138257 to your computer and use it in GitHub Desktop.
Save alpmestan/5209f1efde0e17138257 to your computer and use it in GitHub Desktop.
reusable operations, in servant 0.2
--
type CRUD (resourceName :: Symbol) i a =
resourceName :> Get [a] -- optional: list all
:<|> resourceName :> ReqBody a :> Post a -- create
:<|> resourceName :> Capture "id" i :> Get a -- read
:<|> resourceName :> Capture "id" i :> ReqBody a :> Put a -- update
:<|> resourceName :> Capture "id" i :> Delete -- delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment