git.iko.soy/typeable/servant
on master help sign in
removing DerivingStrategies extension (not compatible ghc < 8.2.1)
9357583akhesacaro
doc/cookbook/uverb/UVerb.lhs+7−5
@@ -9,9 +9,7 @@ handlers that respond with arbitrary open unions of types.
9```haskell
9```haskell
10{-# LANGUAGE ConstraintKinds #-}
10{-# LANGUAGE ConstraintKinds #-}
11{-# LANGUAGE DataKinds #-}
11{-# LANGUAGE DataKinds #-}
12−{-# LANGUAGE DeriveAnyClass #-}
13{-# LANGUAGE DeriveGeneric #-}
12{-# LANGUAGE DeriveGeneric #-}
14−{-# LANGUAGE DerivingStrategies #-}
15{-# LANGUAGE FlexibleContexts #-}
13{-# LANGUAGE FlexibleContexts #-}
16{-# LANGUAGE FlexibleInstances #-}
14{-# LANGUAGE FlexibleInstances #-}
17{-# LANGUAGE GeneralizedNewtypeDeriving #-}
15{-# LANGUAGE GeneralizedNewtypeDeriving #-}
@@ -133,7 +131,7 @@ Since `UVerb` (probably) will mostly be used for error-like responses, it may be
133
131
134```haskell
132```haskell
135newtype UVerbT xs m a = UVerbT { unUVerbT :: ExceptT (Union xs) m a }
133newtype UVerbT xs m a = UVerbT { unUVerbT :: ExceptT (Union xs) m a }
136− deriving newtype (Functor, Applicative, Monad, MonadTrans)
134+ deriving (Functor, Applicative, Monad, MonadTrans)
137
135
138-- | Deliberately hide 'ExceptT's 'MonadError' instance to be able to use
136-- | Deliberately hide 'ExceptT's 'MonadError' instance to be able to use
139-- underlying monad's instance.
137-- underlying monad's instance.
@@ -156,13 +154,17 @@ Example usage:
156
154
157```haskell
155```haskell
158data Foo = Foo Int Int Int
156data Foo = Foo Int Int Int
159− deriving (Show, Eq, GHC.Generic, ToJSON)
157+ deriving (Show, Eq, GHC.Generic)
158+
159+instance ToJSON Foo
160
160
161instance HasStatus Foo where
161instance HasStatus Foo where
162 type StatusOf Foo = 200
162 type StatusOf Foo = 200
163
163
164data Bar = Bar
164data Bar = Bar
165− deriving (Show, Eq, GHC.Generic, ToJSON)
165+ deriving (Show, Eq, GHC.Generic)
166+
167+instance ToJSON Bar
166
168
167h :: Handler (Union '[Foo, WithStatus 400 Bar])
169h :: Handler (Union '[Foo, WithStatus 400 Bar])
168h = runUVerbT $ do
170h = runUVerbT $ do