Skip to content

Commit e275955

Browse files
committed
MonadReader BlockfrostT
1 parent 956eb25 commit e275955

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/blockfrost/lib/Convex/Blockfrost.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import Control.Monad.Except (
3939
runExceptT,
4040
)
4141
import Control.Monad.IO.Class (MonadIO (..))
42-
import Control.Monad.Reader (ReaderT (..))
42+
import Control.Monad.Reader (MonadReader (..), ReaderT (..))
4343
import Control.Monad.State.Strict (StateT)
4444
import Control.Monad.State.Strict qualified as State
4545
import Control.Monad.Trans.Class (MonadTrans (lift))
@@ -80,6 +80,10 @@ down = coerce
8080
instance MonadTrans BlockfrostT where
8181
lift = BlockfrostT . lift . lift
8282

83+
instance (MonadReader e m) => MonadReader e (BlockfrostT m) where
84+
ask = lift ask
85+
local f (up -> a) = down $ \cache config -> local f (a cache config)
86+
8387
instance (MonadError e m) => MonadError e (BlockfrostT m) where
8488
throwError = lift . throwError
8589
catchError (up -> action) handler = down $ \cache config ->

0 commit comments

Comments
 (0)