git.iko.soy/typeable/control-has
on master help sign in
Move katip-related things out of control-has package (#6095)
commit42beb50adeaba74af08f22d31e1fa3fab4525b45 authorVladimir Kalnitsky <klntsky@typeable.io> dateTue 1 Jun 2021, 13:48 (5 years ago) parent32f4a77
2 files changed−29
control-has.cabal−2 src/Control/EnvT.hs−27
control-has.cabal−2
@@ -17,8 +17,6 @@ library
1717 , mtl
1818 , resourcet
1919 , transformers-base
20− if !impl(ghcjs)
21− build-depends: katip
2220 default-language: Haskell2010
2321 default-extensions: ConstraintKinds
2422 , DataKinds
src/Control/EnvT.hs−27
@@ -1,4 +1,3 @@
1−{-# LANGUAGE CPP #-}
21{-# LANGUAGE TemplateHaskell #-}
32
43module Control.EnvT
@@ -19,10 +18,6 @@ import Control.Monad.Reader as X
1918import Control.Monad.Trans.Control
2019import Control.Monad.Trans.Resource
2120import Control.Monad.Zip
22−#ifndef ghcjs_HOST_OS
23−import Katip
24−import Katip.Monadic
25−#endif
2621
2722
2823-- | The only reason this exists is that there are a lot of instances for
@@ -63,27 +58,5 @@ execEnvT :: forall r m a. r -> EnvT r m a -> m a
6358execEnvT = flip runEnvT
6459{-# INLINE execEnvT #-}
6560
66−#ifndef ghcjs_HOST_OS
67−-- FIXME: These lens should probably be moved into a separate package
68−-- or sent to upstream katip.
69−makeLensesFor
70− [ ("ltsLogEnv", "_ltsLogEnv")
71− , ("ltsContext", "_ltsContext")
72− , ("ltsNamespace", "_ltsNamespace")
73− ] ''KatipContextTState
74−
75−instance (Has KatipContextTState r, MonadIO m)
76− => KatipContext (EnvT r m) where
77− getKatipContext = view $ part . _ltsContext
78− localKatipContext f = local (part . _ltsContext %~ f)
79− getKatipNamespace = view $ part . _ltsNamespace
80− localKatipNamespace f = local (part . _ltsNamespace %~ f)
81−
82−instance (Has KatipContextTState r, MonadIO m)
83− => Katip (EnvT r m) where
84− getLogEnv = view $ part . _ltsLogEnv
85− localLogEnv f = local (part . _ltsLogEnv %~ f)
86−#endif
87−
8861instance MonadResource m => MonadResource (EnvT r m) where
8962 liftResourceT = lift . liftResourceT