@@ -4,12 +4,19 @@ Servant allows you to talk about the exceptions you throw in your API
4
4
types. This is not limited to actual exceptions, you can write
5
5
handlers that respond with arbitrary open unions of types.
6
6
7
+ ## Compatibility
8
+
9
+ :warning: This cookbook is compatible with GHC 8.6.1 or higher :warning:
10
+
7
11
## Preliminaries
8
12
9
13
`` `haskell
10
14
{-# LANGUAGE ConstraintKinds #-}
11
15
{-# LANGUAGE DataKinds #-}
12
16
{-# LANGUAGE DeriveGeneric #-}
17
+ {-# LANGUAGE DerivingStrategies #-}
18
+ {-# LANGUAGE DeriveAnyClass #-}
19
+ {-# LANGUAGE DerivingVia #-}
13
20
{-# LANGUAGE FlexibleContexts #-}
14
21
{-# LANGUAGE FlexibleInstances #-}
15
22
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
@@ -154,12 +161,8 @@ Example usage:
154
161
155
162
```haskell
156
163
data Foo = Foo Int Int Int
157
- deriving (Show, Eq, GHC.Generic)
158
-
159
- instance ToJSON Foo
160
-
161
- instance HasStatus Foo where
162
- type StatusOf Foo = 200
164
+ deriving (Show, Eq, GHC.Generic, ToJSON)
165
+ deriving HasStatus via WithStatus 200 Foo
163
166
164
167
data Bar = Bar
165
168
deriving (Show, Eq, GHC.Generic)
0 commit comments