servant-waargonaut- Servant Integration for Waargonaut JSON Package

Safe HaskellNone



Integrate Waargonaut with Servant, including support for the tagged typeclass encoder/decoder functionality.



data WaargJSON t Source #

Replacement for JSON that will use the relevant instances from Waargonaut that are tagged with the type t.

This allows you to have separate typeclass implementations for the same type for different routes and have it be evident in the types. Without the need for creating a 'newtype' for each one.

Where you would use JSON to use aeson for encoding or decoding, you use 'WaargJSON t', with the t denoting the tag type. Refer to the Waargonaut package for more information about why this is so.

A hello world example:

>>> -- GET /hello/world
>>> -- returning a JSON encoded World value
>>> data MyTag = MyTag
>>> type MyApi = "hello" :> "world" :> Get '[WaargJSON MyTag] World