removing DerivingStrategies extension (not compatible ghc < 8.2.1)
This commit is contained in:
parent
08b5e86536
commit
9357583459
1 changed files with 7 additions and 5 deletions
|
@ -9,9 +9,7 @@ handlers that respond with arbitrary open unions of types.
|
||||||
```haskell
|
```haskell
|
||||||
{-# LANGUAGE ConstraintKinds #-}
|
{-# LANGUAGE ConstraintKinds #-}
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE DeriveAnyClass #-}
|
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE DerivingStrategies #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||||
|
@ -133,7 +131,7 @@ Since `UVerb` (probably) will mostly be used for error-like responses, it may be
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
newtype UVerbT xs m a = UVerbT { unUVerbT :: ExceptT (Union xs) m a }
|
newtype UVerbT xs m a = UVerbT { unUVerbT :: ExceptT (Union xs) m a }
|
||||||
deriving newtype (Functor, Applicative, Monad, MonadTrans)
|
deriving (Functor, Applicative, Monad, MonadTrans)
|
||||||
|
|
||||||
-- | Deliberately hide 'ExceptT's 'MonadError' instance to be able to use
|
-- | Deliberately hide 'ExceptT's 'MonadError' instance to be able to use
|
||||||
-- underlying monad's instance.
|
-- underlying monad's instance.
|
||||||
|
@ -156,13 +154,17 @@ Example usage:
|
||||||
|
|
||||||
```haskell
|
```haskell
|
||||||
data Foo = Foo Int Int Int
|
data Foo = Foo Int Int Int
|
||||||
deriving (Show, Eq, GHC.Generic, ToJSON)
|
deriving (Show, Eq, GHC.Generic)
|
||||||
|
|
||||||
|
instance ToJSON Foo
|
||||||
|
|
||||||
instance HasStatus Foo where
|
instance HasStatus Foo where
|
||||||
type StatusOf Foo = 200
|
type StatusOf Foo = 200
|
||||||
|
|
||||||
data Bar = Bar
|
data Bar = Bar
|
||||||
deriving (Show, Eq, GHC.Generic, ToJSON)
|
deriving (Show, Eq, GHC.Generic)
|
||||||
|
|
||||||
|
instance ToJSON Bar
|
||||||
|
|
||||||
h :: Handler (Union '[Foo, WithStatus 400 Bar])
|
h :: Handler (Union '[Foo, WithStatus 400 Bar])
|
||||||
h = runUVerbT $ do
|
h = runUVerbT $ do
|
||||||
|
|
Loading…
Reference in a new issue