From 8801a3e5800679e68e11db703d3bef1081dde523 Mon Sep 17 00:00:00 2001 From: Michael Xavier Date: Thu, 3 Dec 2015 15:47:24 -0800 Subject: [PATCH] simplify type to IO --- src/Database/Bloodhound/Client.hs | 6 +++--- src/Database/Bloodhound/Types/Internal.hs | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Database/Bloodhound/Client.hs b/src/Database/Bloodhound/Client.hs index 7af3b73..e987c4b 100644 --- a/src/Database/Bloodhound/Client.hs +++ b/src/Database/Bloodhound/Client.hs @@ -176,9 +176,9 @@ dispatch dMethod url body = do initReq <- liftIO $ parseUrl' url reqHook <- bhRequestHook <$> getBHEnv let reqBody = RequestBodyLBS $ fromMaybe emptyBody body - req <- reqHook $ initReq { method = dMethod - , requestBody = reqBody - , checkStatus = \_ _ _ -> Nothing} + req <- liftIO $ reqHook $ initReq { method = dMethod + , requestBody = reqBody + , checkStatus = \_ _ _ -> Nothing} mgr <- bhManager <$> getBHEnv liftIO $ httpLbs req mgr diff --git a/src/Database/Bloodhound/Types/Internal.hs b/src/Database/Bloodhound/Types/Internal.hs index 9e95549..66769c9 100644 --- a/src/Database/Bloodhound/Types/Internal.hs +++ b/src/Database/Bloodhound/Types/Internal.hs @@ -2,7 +2,6 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE RankNTypes #-} ------------------------------------------------------------------------------- -- | @@ -34,7 +33,7 @@ import Network.HTTP.Client -} data BHEnv = BHEnv { bhServer :: Server , bhManager :: Manager - , bhRequestHook :: forall m. (MonadBH m) => Request -> m Request + , bhRequestHook :: Request -> IO Request -- ^ Low-level hook that is run before every request is sent. Used to implement custom authentication strategies. Defaults to 'return' with 'mkBHEnv'. }