git.iko.soy/typeable/servant
on master help sign in
Change Semigroup (ClientM a) to Alt ClientM
commit6fafaec51ada3025b1087e162daf49eba1af87f1 authorOleg Grenrus <oleg.grenrus@iki.fi> dateFri 20 Jan 2017, 14:26 (10 years ago) parentfdf86b0
2 files changed+5−3
servant-client/servant-client.cabal+1 servant-client/src/Servant/Common/Req.hs+4−3
servant-client/servant-client.cabal+1
@@ -52,6 +52,7 @@ library
5252 , monad-control >= 1.0.0.4 && < 1.1
5353 , network-uri >= 2.6 && < 2.7
5454 , safe >= 0.3.9 && < 0.4
55+ , semigroupoids >= 4.3 && < 5.2
5556 , servant == 0.9.*
5657 , string-conversions >= 0.3 && < 0.5
5758 , text >= 1.2 && < 1.3
servant-client/src/Servant/Common/Req.hs+4−3
@@ -16,7 +16,8 @@ import Control.Exception
1616import Control.Monad
1717import Control.Monad.Catch (MonadThrow, MonadCatch)
1818import Data.Foldable (toList)
19−import Data.Semigroup (Semigroup (..))
19+import Data.Functor.Alt (Alt (..))
20+import Data.Semigroup ((<>))
2021
2122import Control.Monad.Error.Class (MonadError(..))
2223import Control.Monad.Trans.Except
@@ -216,8 +217,8 @@ instance MonadBaseControl IO ClientM where
216217 restoreM st = ClientM (restoreM st)
217218
218219-- | Try clients in order, last error is preserved.
219−instance Semigroup (ClientM a) where
220− a <> b = a `catchError` \_ -> b
220+instance Alt ClientM where
221+ a <!> b = a `catchError` \_ -> b
221222
222223runClientM :: ClientM a -> ClientEnv -> IO (Either ServantError a)
223224runClientM cm env = runExceptT $ (flip runReaderT env) $ runClientM' cm