git.iko.soy/typeable/bloodhound
on master help sign in
simplify type to IO
8801a3eMichael Xavier
src/Database/Bloodhound/Client.hs+3−3
@@ -176,9 +176,9 @@ dispatch dMethod url body = do
176 initReq <- liftIO $ parseUrl' url
176 initReq <- liftIO $ parseUrl' url
177 reqHook <- bhRequestHook <$> getBHEnv
177 reqHook <- bhRequestHook <$> getBHEnv
178 let reqBody = RequestBodyLBS $ fromMaybe emptyBody body
178 let reqBody = RequestBodyLBS $ fromMaybe emptyBody body
179− req <- reqHook $ initReq { method = dMethod
179+ req <- liftIO $ reqHook $ initReq { method = dMethod
180− , requestBody = reqBody
180+ , requestBody = reqBody
181− , checkStatus = \_ _ _ -> Nothing}
181+ , checkStatus = \_ _ _ -> Nothing}
182 mgr <- bhManager <$> getBHEnv
182 mgr <- bhManager <$> getBHEnv
183 liftIO $ httpLbs req mgr
183 liftIO $ httpLbs req mgr
184
184
src/Database/Bloodhound/Types/Internal.hs+1−2
@@ -2,7 +2,6 @@
2{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE GeneralizedNewtypeDeriving #-}
4{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5−{-# LANGUAGE RankNTypes #-}
6
5
7-------------------------------------------------------------------------------
6-------------------------------------------------------------------------------
8-- |
7-- |
@@ -34,7 +33,7 @@ import Network.HTTP.Client
34-}
33-}
35data BHEnv = BHEnv { bhServer :: Server
34data BHEnv = BHEnv { bhServer :: Server
36 , bhManager :: Manager
35 , bhManager :: Manager
37− , bhRequestHook :: forall m. (MonadBH m) => Request -> m Request
36+ , bhRequestHook :: Request -> IO Request
38 -- ^ Low-level hook that is run before every request is sent. Used to implement custom authentication strategies. Defaults to 'return' with 'mkBHEnv'.
37 -- ^ Low-level hook that is run before every request is sent. Used to implement custom authentication strategies. Defaults to 'return' with 'mkBHEnv'.
39 }
38 }
40
39