From ee100d7be0910dcdc6851bf843c229276c7dab9e Mon Sep 17 00:00:00 2001 From: Ross MacLeod Date: Wed, 21 Sep 2016 14:41:30 -0400 Subject: [PATCH 1/4] Add instance of MonadHandler and MonadWidget for ExceptT --- yesod-core/Yesod/Core/Class/Handler.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yesod-core/Yesod/Core/Class/Handler.hs b/yesod-core/Yesod/Core/Class/Handler.hs index f525b3be..bd4788c3 100644 --- a/yesod-core/Yesod/Core/Class/Handler.hs +++ b/yesod-core/Yesod/Core/Class/Handler.hs @@ -24,6 +24,7 @@ import Control.Monad.Trans.Identity ( IdentityT) import Control.Monad.Trans.List ( ListT ) import Control.Monad.Trans.Maybe ( MaybeT ) import Control.Monad.Trans.Error ( ErrorT, Error) +import Control.Monad.Trans.Except ( ExceptT ) import Control.Monad.Trans.Reader ( ReaderT ) import Control.Monad.Trans.State ( StateT ) import Control.Monad.Trans.Writer ( WriterT ) @@ -55,6 +56,7 @@ GO(IdentityT) GO(ListT) GO(MaybeT) GOX(Error e, ErrorT e) +GO(ExceptT e) GO(ReaderT r) GO(StateT s) GOX(Monoid w, WriterT w) @@ -78,6 +80,7 @@ GO(IdentityT) GO(ListT) GO(MaybeT) GOX(Error e, ErrorT e) +GO(ExceptT e) GO(ReaderT r) GO(StateT s) GOX(Monoid w, WriterT w) From 58fb977276e7e4c5d9640f2cbff89e9e3f3470f4 Mon Sep 17 00:00:00 2001 From: Ross MacLeod Date: Thu, 22 Sep 2016 12:59:54 -0400 Subject: [PATCH 2/4] Only emit MonadHandler and MonadWidget instance for ExceptT when GHC version >= 7.10, since that's the first version tied to transformers-0.4.0.0 which introduced ExceptT --- yesod-core/Yesod/Core/Class/Handler.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yesod-core/Yesod/Core/Class/Handler.hs b/yesod-core/Yesod/Core/Class/Handler.hs index bd4788c3..8b4b822d 100644 --- a/yesod-core/Yesod/Core/Class/Handler.hs +++ b/yesod-core/Yesod/Core/Class/Handler.hs @@ -56,7 +56,9 @@ GO(IdentityT) GO(ListT) GO(MaybeT) GOX(Error e, ErrorT e) +#if __GLASGOW_HASKELL__ >= 710 GO(ExceptT e) +#endif GO(ReaderT r) GO(StateT s) GOX(Monoid w, WriterT w) @@ -80,7 +82,9 @@ GO(IdentityT) GO(ListT) GO(MaybeT) GOX(Error e, ErrorT e) +#if __GLASGOW_HASKELL__ >= 710 GO(ExceptT e) +#endif GO(ReaderT r) GO(StateT s) GOX(Monoid w, WriterT w) From 6de5d8f829bc46f2145022757cdd258b9401abd5 Mon Sep 17 00:00:00 2001 From: Ross MacLeod Date: Thu, 22 Sep 2016 13:23:10 -0400 Subject: [PATCH 3/4] missed making the import of ExceptT conditional on GHC version as well --- yesod-core/Yesod/Core/Class/Handler.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yesod-core/Yesod/Core/Class/Handler.hs b/yesod-core/Yesod/Core/Class/Handler.hs index 8b4b822d..dc0bf920 100644 --- a/yesod-core/Yesod/Core/Class/Handler.hs +++ b/yesod-core/Yesod/Core/Class/Handler.hs @@ -24,7 +24,9 @@ import Control.Monad.Trans.Identity ( IdentityT) import Control.Monad.Trans.List ( ListT ) import Control.Monad.Trans.Maybe ( MaybeT ) import Control.Monad.Trans.Error ( ErrorT, Error) +#if __GLASGOW_HASKELL__ >= 710 import Control.Monad.Trans.Except ( ExceptT ) +#endif import Control.Monad.Trans.Reader ( ReaderT ) import Control.Monad.Trans.State ( StateT ) import Control.Monad.Trans.Writer ( WriterT ) From 09c37eb916582be078a2ca9d69d489ae4024601d Mon Sep 17 00:00:00 2001 From: Ross MacLeod Date: Thu, 22 Sep 2016 13:27:25 -0400 Subject: [PATCH 4/4] Use #if MIN_VERSION_transformers(0,4,0) instead of __GLASGOW_HASKELL__ >= 710 --- yesod-core/Yesod/Core/Class/Handler.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yesod-core/Yesod/Core/Class/Handler.hs b/yesod-core/Yesod/Core/Class/Handler.hs index dc0bf920..9890511a 100644 --- a/yesod-core/Yesod/Core/Class/Handler.hs +++ b/yesod-core/Yesod/Core/Class/Handler.hs @@ -24,7 +24,7 @@ import Control.Monad.Trans.Identity ( IdentityT) import Control.Monad.Trans.List ( ListT ) import Control.Monad.Trans.Maybe ( MaybeT ) import Control.Monad.Trans.Error ( ErrorT, Error) -#if __GLASGOW_HASKELL__ >= 710 +#if MIN_VERSION_transformers(0,4,0) import Control.Monad.Trans.Except ( ExceptT ) #endif import Control.Monad.Trans.Reader ( ReaderT ) @@ -58,7 +58,7 @@ GO(IdentityT) GO(ListT) GO(MaybeT) GOX(Error e, ErrorT e) -#if __GLASGOW_HASKELL__ >= 710 +#if MIN_VERSION_transformers(0,4,0) GO(ExceptT e) #endif GO(ReaderT r) @@ -84,7 +84,7 @@ GO(IdentityT) GO(ListT) GO(MaybeT) GOX(Error e, ErrorT e) -#if __GLASGOW_HASKELL__ >= 710 +#if MIN_VERSION_transformers(0,4,0) GO(ExceptT e) #endif GO(ReaderT r)