From 9357583459f6d406dc80d23d61115ef2345a9877 Mon Sep 17 00:00:00 2001 From: akhesacaro Date: Tue, 16 Mar 2021 21:03:09 +0100 Subject: [PATCH] removing DerivingStrategies extension (not compatible ghc < 8.2.1) --- doc/cookbook/uverb/UVerb.lhs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/cookbook/uverb/UVerb.lhs b/doc/cookbook/uverb/UVerb.lhs index d281a383..2119706c 100644 --- a/doc/cookbook/uverb/UVerb.lhs +++ b/doc/cookbook/uverb/UVerb.lhs @@ -9,9 +9,7 @@ handlers that respond with arbitrary open unions of types. ```haskell {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} @@ -133,7 +131,7 @@ Since `UVerb` (probably) will mostly be used for error-like responses, it may be ```haskell 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 -- underlying monad's instance. @@ -156,13 +154,17 @@ Example usage: ```haskell data Foo = Foo Int Int Int - deriving (Show, Eq, GHC.Generic, ToJSON) + deriving (Show, Eq, GHC.Generic) + +instance ToJSON Foo instance HasStatus Foo where type StatusOf Foo = 200 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 = runUVerbT $ do