on master help sign in
Allow for unliftio-core 0.2's breaking changes
5238b4cMichael Xavier
katip/src/Katip/Core.hs+7−2
@@ -901,9 +901,14 @@ instance (MonadBaseControl b m) => MonadBaseControl b (KatipT m) where
901 restoreM = defaultRestoreM
901 restoreM = defaultRestoreM
902
902
903instance MonadUnliftIO m => MonadUnliftIO (KatipT m) where
903instance MonadUnliftIO m => MonadUnliftIO (KatipT m) where
904+#if MIN_VERSION_unliftio_core(0, 2, 0)
905+ withRunInIO inner = KatipT $ ReaderT $ \le -> withRunInIO $ \run ->
906+ inner (run . runKatipT le)
907+#else
904 askUnliftIO = KatipT $
908 askUnliftIO = KatipT $
905− withUnliftIO $ \u ->
909+ withUnliftIO $ \u ->
906− pure (UnliftIO (unliftIO u . unKatipT))
910+ pure (UnliftIO (unliftIO u . unKatipT))
911+#endif
907
912
908#if MIN_VERSION_base(4, 9, 0)
913#if MIN_VERSION_base(4, 9, 0)
909instance MF.MonadFail m => MF.MonadFail (KatipT m) where
914instance MF.MonadFail m => MF.MonadFail (KatipT m) where
katip/src/Katip/Monadic.hs+16−4
@@ -395,9 +395,15 @@ instance (MonadIO m) => KatipContext (KatipContextT m) where
395 localKatipNamespace f (KatipContextT m) = KatipContextT $ local (\s -> s { ltsNamespace = f (ltsNamespace s)}) m
395 localKatipNamespace f (KatipContextT m) = KatipContextT $ local (\s -> s { ltsNamespace = f (ltsNamespace s)}) m
396
396
397instance MonadUnliftIO m => MonadUnliftIO (KatipContextT m) where
397instance MonadUnliftIO m => MonadUnliftIO (KatipContextT m) where
398+#if MIN_VERSION_unliftio_core(0, 2, 0)
399+ withRunInIO inner = KatipContextT $ ReaderT $ \lts -> withRunInIO $ \run ->
400+ inner (run . runKatipContextT (ltsLogEnv lts) (ltsContext lts) (ltsNamespace lts))
401+#else
398 askUnliftIO = KatipContextT $
402 askUnliftIO = KatipContextT $
399− withUnliftIO $ \u ->
403+ withUnliftIO $ \u ->
400− pure (UnliftIO (unliftIO u . unKatipContextT))
404+ pure (UnliftIO (unliftIO u . unKatipContextT))
405+#endif
406+
401
407
402#if MIN_VERSION_base(4, 9, 0)
408#if MIN_VERSION_base(4, 9, 0)
403instance MF.MonadFail m => MF.MonadFail (KatipContextT m) where
409instance MF.MonadFail m => MF.MonadFail (KatipContextT m) where
@@ -482,9 +488,15 @@ instance MonadBaseControl b m => MonadBaseControl b (NoLoggingT m) where
482 restoreM = NoLoggingT . restoreM
488 restoreM = NoLoggingT . restoreM
483
489
484instance MonadUnliftIO m => MonadUnliftIO (NoLoggingT m) where
490instance MonadUnliftIO m => MonadUnliftIO (NoLoggingT m) where
491+#if MIN_VERSION_unliftio_core(0, 2, 0)
492+ withRunInIO inner = NoLoggingT $ withRunInIO $ \run ->
493+ inner (run . runNoLoggingT)
494+#else
485 askUnliftIO = NoLoggingT $
495 askUnliftIO = NoLoggingT $
486− withUnliftIO $ \u ->
496+ withUnliftIO $ \u ->
487− pure (UnliftIO (unliftIO u . runNoLoggingT))
497+ pure (UnliftIO (unliftIO u . runNoLoggingT))
498+#endif
499+
488
500
489instance MonadIO m => Katip (NoLoggingT m) where
501instance MonadIO m => Katip (NoLoggingT m) where
490 getLogEnv = liftIO (initLogEnv "NoLoggingT" "no-logging")
502 getLogEnv = liftIO (initLogEnv "NoLoggingT" "no-logging")
stack.yaml+2−1
@@ -6,7 +6,8 @@ packages:
6 - katip-logzio
6 - katip-logzio
7extra-deps:
7extra-deps:
8 - bloodhound-0.16.0.0
8 - bloodhound-0.16.0.0
9− - unliftio-core-0.1.2.0
9+ - unliftio-core-0.2.0.1
10+ - resourcet-1.2.3
10flags:
11flags:
11 katip:
12 katip:
12 lib-Werror: true
13 lib-Werror: true