on master help sign in
Add public API for statically dispatched effects
1560ddcAndrzej Rybczak
effectful-core/effectful-core.cabal+3−2
@@ -77,10 +77,11 @@ library
77
77
78 hs-source-dirs: src
78 hs-source-dirs: src
79
79
80− exposed-modules: Effectful.Error
80+ exposed-modules: Effectful.Dispatch.Dynamic
81+ Effectful.Dispatch.Static
82+ Effectful.Error
81 Effectful.Error.Dynamic
83 Effectful.Error.Dynamic
82 Effectful.Fail
84 Effectful.Fail
83− Effectful.Handler
84 Effectful.Internal.Effect
85 Effectful.Internal.Effect
85 Effectful.Internal.Env
86 Effectful.Internal.Env
86 Effectful.Internal.Monad
87 Effectful.Internal.Monad
effectful-core/src/Effectful/Handler.hs → effectful-core/src/Effectful/Dispatch/Dynamic.hsrenamed+1−1
@@ -1,4 +1,4 @@
1−module Effectful.Handler
1+module Effectful.Dispatch.Dynamic
2 ( -- * Sending operations to the handler
2 ( -- * Sending operations to the handler
3 send
3 send
4
4
effectful-core/src/Effectful/Dispatch/Static.hsnew file+51
@@ -0,0 +1,51 @@
1+module Effectful.Dispatch.Static
2+ ( -- * Low level API
3+ IdE(..)
4+
5+ -- ** Running
6+ , runEffect
7+ , evalEffect
8+ , execEffect
9+
10+ -- ** Modification
11+ , getEffect
12+ , putEffect
13+ , stateEffect
14+ , stateEffectM
15+ , localEffect
16+
17+ -- * Primitive API
18+ , Env
19+ , Relinker(..)
20+ , noRelinker
21+
22+ -- ** Operations
23+ , emptyEnv
24+ , cloneEnv
25+ , forkEnv
26+ , sizeEnv
27+ , checkSizeEnv
28+
29+ -- ** Extending and shrinking
30+ , unsafeConsEnv
31+ , unsafeTailEnv
32+
33+ -- ** Data retrieval and update
34+ , getEnv
35+ , putEnv
36+ , stateEnv
37+ , modifyEnv
38+
39+ -- * Unsafe 'Eff' operations
40+ , unsafeEff
41+ , unsafeEff_
42+ , unsafeLiftMapIO
43+ , unsafeUnliftIO
44+
45+ -- * Utils
46+ , unEff
47+ ) where
48+
49+import Effectful.Internal.Effect
50+import Effectful.Internal.Env
51+import Effectful.Internal.Monad
effectful-core/src/Effectful/Error.hs+2−3
@@ -37,9 +37,8 @@ import Data.Typeable
37import Data.Unique
37import Data.Unique
38import GHC.Stack
38import GHC.Stack
39
39
40−import Effectful.Internal.Effect
40+import Effectful.Dispatch.Static
41−import Effectful.Internal.Env
42−import Effectful.Internal.Monad
41+import Effectful.Monad
43
42
44newtype Error e :: Effect where
43newtype Error e :: Effect where
45 Error :: ErrorId -> Error e m r
44 Error :: ErrorId -> Error e m r
effectful-core/src/Effectful/Error/Dynamic.hs+1−1
@@ -8,7 +8,7 @@ module Effectful.Error.Dynamic
8
8
9import Data.Typeable
9import Data.Typeable
10
10
11−import Effectful.Handler
11+import Effectful.Dispatch.Dynamic
12import Effectful.Monad
12import Effectful.Monad
13import qualified Effectful.Error as E
13import qualified Effectful.Error as E
14
14
effectful-core/src/Effectful/Fail.hs+1−1
@@ -3,8 +3,8 @@ module Effectful.Fail
3 , runFail
3 , runFail
4 ) where
4 ) where
5
5
6+import Effectful.Dispatch.Dynamic
6import Effectful.Error
7import Effectful.Error
7−import Effectful.Handler
8import Effectful.Internal.Monad
8import Effectful.Internal.Monad
9
9
10-- | Run the 'Fail' effect via 'Error'.
10-- | Run the 'Fail' effect via 'Error'.
effectful-core/src/Effectful/Internal/Effect.hs+1−1
@@ -23,7 +23,7 @@ import GHC.TypeLits
23-- | The kind of effects.
23-- | The kind of effects.
24type Effect = (Type -> Type) -> Type -> Type
24type Effect = (Type -> Type) -> Type -> Type
25
25
26−-- | Adapter for statically dispatched effects.
26+-- | An adapter for statically dispatched effects.
27newtype IdE :: Effect -> Type where
27newtype IdE :: Effect -> Type where
28 IdE :: (forall m r. e m r) -> IdE e
28 IdE :: (forall m r. e m r) -> IdE e
29
29
effectful-core/src/Effectful/Internal/Env.hs+12−12
@@ -152,11 +152,11 @@ newForkId (ForkIdGen ref) = do
152-- the environment.
152-- the environment.
153newtype Relinker :: (Effect -> Type) -> Effect -> Type where
153newtype Relinker :: (Effect -> Type) -> Effect -> Type where
154 Relinker
154 Relinker
155− :: ((forall es. Env es -> IO (Env es)) -> handler e -> IO (handler e))
155+ :: ((forall es. Env es -> IO (Env es)) -> adapter e -> IO (adapter e))
156− -> Relinker handler e
156+ -> Relinker adapter e
157
157
158-- | A dummy 'Relinker' that does nothing.
158-- | A dummy 'Relinker' that does nothing.
159−noRelinker :: Relinker handler e
159+noRelinker :: Relinker adapter e
160noRelinker = Relinker $ \_ -> pure
160noRelinker = Relinker $ \_ -> pure
161
161
162----------------------------------------
162----------------------------------------
@@ -344,7 +344,7 @@ checkSizeEnv k (Env (Forks _ baseIx lref _) _ _) = do
344-- This function is __highly unsafe__ because it renders the input 'Env'
344-- This function is __highly unsafe__ because it renders the input 'Env'
345-- unusable until the corresponding 'unsafeTailEnv' call is made, but it's not
345-- unusable until the corresponding 'unsafeTailEnv' call is made, but it's not
346-- checked anywhere.
346-- checked anywhere.
347−unsafeConsEnv :: handler e -> Relinker handler e -> Env es -> IO (Env (e : es))
347+unsafeConsEnv :: adapter e -> Relinker adapter e -> Env es -> IO (Env (e : es))
348unsafeConsEnv e f (Env fork gref gen) = case fork of
348unsafeConsEnv e f (Env fork gref gen) = case fork of
349 NoFork -> do
349 NoFork -> do
350 extendEnvRef gref
350 extendEnvRef gref
@@ -403,18 +403,18 @@ unsafeTailEnv len (Env fork gref _) = case fork of
403
403
404-- | Extract a specific data type from the environment.
404-- | Extract a specific data type from the environment.
405getEnv
405getEnv
406− :: forall e es handler. e :> es
406+ :: forall e es adapter. e :> es
407 => Env es
407 => Env es
408− -> IO (handler e)
408+ -> IO (adapter e)
409getEnv env = do
409getEnv env = do
410 (i, es) <- getLocation (reifyIndex @e @es) env
410 (i, es) <- getLocation (reifyIndex @e @es) env
411 fromAny <$> readSmallArray es i
411 fromAny <$> readSmallArray es i
412
412
413-- | Replace the data type in the environment with a new value (in place).
413-- | Replace the data type in the environment with a new value (in place).
414putEnv
414putEnv
415− :: forall e es handler. e :> es
415+ :: forall e es adapter. e :> es
416 => Env es
416 => Env es
417− -> handler e
417+ -> adapter e
418 -> IO ()
418 -> IO ()
419putEnv env e = do
419putEnv env e = do
420 (i, es) <- getLocation (reifyIndex @e @es) env
420 (i, es) <- getLocation (reifyIndex @e @es) env
@@ -422,9 +422,9 @@ putEnv env e = do
422
422
423-- | Modify the data type in the environment (in place) and return a value.
423-- | Modify the data type in the environment (in place) and return a value.
424stateEnv
424stateEnv
425− :: forall e es handler a. e :> es
425+ :: forall e es adapter a. e :> es
426 => Env es
426 => Env es
427− -> (handler e -> (a, handler e))
427+ -> (adapter e -> (a, adapter e))
428 -> IO a
428 -> IO a
429stateEnv env f = do
429stateEnv env f = do
430 (i, es) <- getLocation (reifyIndex @e @es) env
430 (i, es) <- getLocation (reifyIndex @e @es) env
@@ -434,9 +434,9 @@ stateEnv env f = do
434
434
435-- | Modify the data type in the environment (in place).
435-- | Modify the data type in the environment (in place).
436modifyEnv
436modifyEnv
437− :: forall e es handler. e :> es
437+ :: forall e es adapter. e :> es
438 => Env es
438 => Env es
439− -> (handler e -> handler e)
439+ -> (adapter e -> adapter e)
440 -> IO ()
440 -> IO ()
441modifyEnv env f = do
441modifyEnv env f = do
442 (i, es) <- getLocation (reifyIndex @e @es) env
442 (i, es) <- getLocation (reifyIndex @e @es) env
effectful-core/src/Effectful/Internal/Monad.hs+13−11
@@ -367,7 +367,9 @@ type EffectHandler e es
367 -- ^ The effect performed in the local environment.
367 -- ^ The effect performed in the local environment.
368 -> Eff es a
368 -> Eff es a
369
369
370+-- | An adapter for dynamically dispatched effects.
371+--
370−-- | An effect handler bundled along with its environment.
372+-- Represents the effect handler bundled along with its environment.
371data Handler :: Effect -> Type where
373data Handler :: Effect -> Type where
372 Handler :: !(Env es) -> !(EffectHandler e es) -> Handler e
374 Handler :: !(Env es) -> !(EffectHandler e es) -> Handler e
373
375
@@ -387,49 +389,49 @@ runHandler e m = unsafeEff $ \es0 -> do
387-- | Send an operation of the given effect to its handler for execution.
389-- | Send an operation of the given effect to its handler for execution.
388send :: (HasCallStack, e :> es) => e (Eff es) a -> Eff es a
390send :: (HasCallStack, e :> es) => e (Eff es) a -> Eff es a
389send op = unsafeEff $ \es -> do
391send op = unsafeEff $ \es -> do
390− Handler env handle <- getEnv es
392+ Handler handlerEs handle <- getEnv es
391− unEff (handle (LocalEnv es) op) env
393+ unEff (handle (LocalEnv es) op) handlerEs
392
394
393----------------------------------------
395----------------------------------------
394-- Helpers
396-- Helpers
395
397
396−runEffect :: handler e -> Eff (e : es) a -> Eff es (a, handler e)
398+runEffect :: adapter e -> Eff (e : es) a -> Eff es (a, adapter e)
397runEffect e0 m = unsafeEff $ \es0 -> do
399runEffect e0 m = unsafeEff $ \es0 -> do
398 size0 <- sizeEnv es0
400 size0 <- sizeEnv es0
399 E.bracket (unsafeConsEnv e0 noRelinker es0)
401 E.bracket (unsafeConsEnv e0 noRelinker es0)
400 (unsafeTailEnv size0)
402 (unsafeTailEnv size0)
401 (\es -> (,) <$> unEff m es <*> getEnv es)
403 (\es -> (,) <$> unEff m es <*> getEnv es)
402
404
403−evalEffect :: handler e -> Eff (e : es) a -> Eff es a
405+evalEffect :: adapter e -> Eff (e : es) a -> Eff es a
404evalEffect e m = unsafeEff $ \es0 -> do
406evalEffect e m = unsafeEff $ \es0 -> do
405 size0 <- sizeEnv es0
407 size0 <- sizeEnv es0
406 E.bracket (unsafeConsEnv e noRelinker es0)
408 E.bracket (unsafeConsEnv e noRelinker es0)
407 (unsafeTailEnv size0)
409 (unsafeTailEnv size0)
408 (\es -> unEff m es)
410 (\es -> unEff m es)
409
411
410−execEffect :: handler e -> Eff (e : es) a -> Eff es (handler e)
412+execEffect :: adapter e -> Eff (e : es) a -> Eff es (adapter e)
411execEffect e0 m = unsafeEff $ \es0 -> do
413execEffect e0 m = unsafeEff $ \es0 -> do
412 size0 <- sizeEnv es0
414 size0 <- sizeEnv es0
413 E.bracket (unsafeConsEnv e0 noRelinker es0)
415 E.bracket (unsafeConsEnv e0 noRelinker es0)
414 (unsafeTailEnv size0)
416 (unsafeTailEnv size0)
415 (\es -> unEff m es *> getEnv es)
417 (\es -> unEff m es *> getEnv es)
416
418
417−getEffect :: e :> es => Eff es (handler e)
419+getEffect :: e :> es => Eff es (adapter e)
418getEffect = unsafeEff $ \es -> getEnv es
420getEffect = unsafeEff $ \es -> getEnv es
419
421
420−putEffect :: e :> es => handler e -> Eff es ()
422+putEffect :: e :> es => adapter e -> Eff es ()
421putEffect e = unsafeEff $ \es -> putEnv es e
423putEffect e = unsafeEff $ \es -> putEnv es e
422
424
423−stateEffect :: e :> es => (handler e -> (a, handler e)) -> Eff es a
425+stateEffect :: e :> es => (adapter e -> (a, adapter e)) -> Eff es a
424stateEffect f = unsafeEff $ \es -> stateEnv es f
426stateEffect f = unsafeEff $ \es -> stateEnv es f
425
427
426−stateEffectM :: e :> es => (handler e -> Eff es (a, handler e)) -> Eff es a
428+stateEffectM :: e :> es => (adapter e -> Eff es (a, adapter e)) -> Eff es a
427stateEffectM f = unsafeEff $ \es -> E.mask $ \release -> do
429stateEffectM f = unsafeEff $ \es -> E.mask $ \release -> do
428 (a, e) <- (\e -> release $ unEff (f e) es) =<< getEnv es
430 (a, e) <- (\e -> release $ unEff (f e) es) =<< getEnv es
429 putEnv es e
431 putEnv es e
430 pure a
432 pure a
431
433
432−localEffect :: e :> es => (handler e -> handler e) -> Eff es a -> Eff es a
434+localEffect :: e :> es => (adapter e -> adapter e) -> Eff es a -> Eff es a
433localEffect f m = unsafeEff $ \es -> do
435localEffect f m = unsafeEff $ \es -> do
434 E.bracket (stateEnv es $ \e -> (e, f e))
436 E.bracket (stateEnv es $ \e -> (e, f e))
435 (\e -> putEnv es e)
437 (\e -> putEnv es e)
effectful-core/src/Effectful/Reader.hs+2−2
@@ -7,8 +7,8 @@ module Effectful.Reader
7 , local
7 , local
8 ) where
8 ) where
9
9
10−import Effectful.Internal.Effect
10+import Effectful.Dispatch.Static
11−import Effectful.Internal.Monad
11+import Effectful.Monad
12
12
13-- | Provide access to a strict (WHNF), thread local, read only value of type
13-- | Provide access to a strict (WHNF), thread local, read only value of type
14-- @r@.
14-- @r@.
effectful-core/src/Effectful/Reader/Dynamic.hs+1−1
@@ -6,7 +6,7 @@ module Effectful.Reader.Dynamic
6 , local
6 , local
7 ) where
7 ) where
8
8
9−import Effectful.Handler
9+import Effectful.Dispatch.Dynamic
10import Effectful.Monad
10import Effectful.Monad
11import qualified Effectful.Reader as R
11import qualified Effectful.Reader as R
12
12
effectful-core/src/Effectful/State/Dynamic.hs+1−1
@@ -22,7 +22,7 @@ module Effectful.State.Dynamic
22 , modifyM
22 , modifyM
23 ) where
23 ) where
24
24
25−import Effectful.Handler
25+import Effectful.Dispatch.Dynamic
26import Effectful.Monad
26import Effectful.Monad
27import qualified Effectful.State.Local as L
27import qualified Effectful.State.Local as L
28import qualified Effectful.State.Shared as S
28import qualified Effectful.State.Shared as S
effectful-core/src/Effectful/State/Local.hs+2−2
@@ -21,8 +21,8 @@ module Effectful.State.Local
21 , modifyM
21 , modifyM
22 ) where
22 ) where
23
23
24−import Effectful.Internal.Effect
24+import Effectful.Dispatch.Static
25−import Effectful.Internal.Monad
25+import Effectful.Monad
26
26
27-- | Provide access to a strict (WHNF), thread local, mutable state of type @s@.
27-- | Provide access to a strict (WHNF), thread local, mutable state of type @s@.
28newtype State s :: Effect where
28newtype State s :: Effect where
effectful-core/src/Effectful/State/Shared.hs+2−3
@@ -22,9 +22,8 @@ module Effectful.State.Shared
22
22
23import Control.Concurrent.MVar
23import Control.Concurrent.MVar
24
24
25−import Effectful.Internal.Effect
25+import Effectful.Dispatch.Static
26−import Effectful.Internal.Env
27−import Effectful.Internal.Monad
26+import Effectful.Monad
28
27
29-- | Provide access to a strict (WHNF), shareable, mutable state of type @s@.
28-- | Provide access to a strict (WHNF), shareable, mutable state of type @s@.
30newtype State s :: Effect where
29newtype State s :: Effect where
effectful-core/src/Effectful/Writer/Dynamic.hs+1−1
@@ -15,7 +15,7 @@ module Effectful.Writer.Dynamic
15 , listens
15 , listens
16 ) where
16 ) where
17
17
18−import Effectful.Handler
18+import Effectful.Dispatch.Dynamic
19import Effectful.Monad
19import Effectful.Monad
20import qualified Effectful.Writer.Local as L
20import qualified Effectful.Writer.Local as L
21import qualified Effectful.Writer.Shared as S
21import qualified Effectful.Writer.Shared as S
effectful-core/src/Effectful/Writer/Local.hs+2−3
@@ -28,9 +28,8 @@ module Effectful.Writer.Local
28
28
29import Control.Exception
29import Control.Exception
30
30
31−import Effectful.Internal.Effect
31+import Effectful.Dispatch.Static
32−import Effectful.Internal.Env
33−import Effectful.Internal.Monad
32+import Effectful.Monad
34
33
35-- | Provide access to a strict (WHNF), thread local, write only value of type
34-- | Provide access to a strict (WHNF), thread local, write only value of type
36-- @w@.
35-- @w@.
effectful-core/src/Effectful/Writer/Shared.hs+2−3
@@ -10,9 +10,8 @@ module Effectful.Writer.Shared
10import Control.Concurrent.MVar
10import Control.Concurrent.MVar
11import Control.Exception
11import Control.Exception
12
12
13−import Effectful.Internal.Effect
13+import Effectful.Dispatch.Static
14−import Effectful.Internal.Env
15−import Effectful.Internal.Monad
14+import Effectful.Monad
16
15
17-- | Provide access to a strict (WHNF), shareable, write only value of type @w@.
16-- | Provide access to a strict (WHNF), shareable, write only value of type @w@.
18newtype Writer w :: Effect where
17newtype Writer w :: Effect where
effectful/effectful.cabal+3−2
@@ -89,10 +89,11 @@ library
89
89
90 other-modules: Effectful.Concurrent.Effect
90 other-modules: Effectful.Concurrent.Effect
91
91
92− reexported-modules: Effectful.Error
92+ reexported-modules: Effectful.Dispatch.Dynamic
93+ , Effectful.Dispatch.Static
94+ , Effectful.Error
93 , Effectful.Error.Dynamic
95 , Effectful.Error.Dynamic
94 , Effectful.Fail
96 , Effectful.Fail
95− , Effectful.Handler
96 , Effectful.Monad
97 , Effectful.Monad
97 , Effectful.Prim
98 , Effectful.Prim
98 , Effectful.Reader
99 , Effectful.Reader
effectful/src/Effectful.hs+1−1
@@ -55,5 +55,5 @@ module Effectful
55 , MonadUnliftIO(..)
55 , MonadUnliftIO(..)
56 ) where
56 ) where
57
57
58−import Effectful.Handler
58+import Effectful.Dispatch.Dynamic
59import Effectful.Monad
59import Effectful.Monad
effectful/src/Effectful/Concurrent.hs+2−3
@@ -52,9 +52,8 @@ import qualified Control.Concurrent as C
52import qualified GHC.Conc as GHC
52import qualified GHC.Conc as GHC
53
53
54import Effectful.Concurrent.Effect
54import Effectful.Concurrent.Effect
55−import Effectful.Internal.Effect
55+import Effectful.Dispatch.Static
56−import Effectful.Internal.Env
57−import Effectful.Internal.Monad
56+import Effectful.Monad
58
57
59----------------------------------------
58----------------------------------------
60-- Basic concurrency operations
59-- Basic concurrency operations
effectful/src/Effectful/Concurrent/Async.hs+3−3
@@ -76,14 +76,14 @@ import Control.Concurrent (threadDelay)
76import Control.Concurrent.Async (Async)
76import Control.Concurrent.Async (Async)
77import Control.Exception (Exception, SomeException)
77import Control.Exception (Exception, SomeException)
78import Control.Monad (forever)
78import Control.Monad (forever)
79+import Data.Kind (Type)
79import qualified Control.Concurrent.Async as A
80import qualified Control.Concurrent.Async as A
80import qualified UnliftIO.Async as U
81import qualified UnliftIO.Async as U
81import qualified UnliftIO.Internals.Async as I
82import qualified UnliftIO.Internals.Async as I
82
83
83import Effectful.Concurrent.Effect
84import Effectful.Concurrent.Effect
84−import Effectful.Internal.Effect
85+import Effectful.Dispatch.Static
85−import Effectful.Internal.Env
86−import Effectful.Internal.Monad
86+import Effectful.Monad
87
87
88-- | Lifted 'A.async'.
88-- | Lifted 'A.async'.
89async :: Concurrent :> es => Eff es a -> Eff es (Async a)
89async :: Concurrent :> es => Eff es a -> Eff es (Async a)
effectful/src/Effectful/Concurrent/Chan.hs+2−2
@@ -13,8 +13,8 @@ import Control.Concurrent.Chan (Chan)
13import qualified Control.Concurrent.Chan as C
13import qualified Control.Concurrent.Chan as C
14
14
15import Effectful.Concurrent.Effect
15import Effectful.Concurrent.Effect
16−import Effectful.Internal.Effect
16+import Effectful.Dispatch.Static
17−import Effectful.Internal.Monad
17+import Effectful.Monad
18
18
19-- | Lifted 'C.newChan'.
19-- | Lifted 'C.newChan'.
20newChan :: Concurrent :> es => Eff es (Chan a)
20newChan :: Concurrent :> es => Eff es (Chan a)
effectful/src/Effectful/Concurrent/Effect.hs+2−2
@@ -4,8 +4,8 @@ module Effectful.Concurrent.Effect
4 , runConcurrent
4 , runConcurrent
5 ) where
5 ) where
6
6
7−import Effectful.Internal.Effect
7+import Effectful.Dispatch.Static
8−import Effectful.Internal.Monad
8+import Effectful.Monad
9
9
10-- | Run 'Eff' operations asynchronously via the @async@ library.
10-- | Run 'Eff' operations asynchronously via the @async@ library.
11--
11--
effectful/src/Effectful/Concurrent/MVar.hs+2−2
@@ -25,8 +25,8 @@ import Control.Concurrent.MVar (MVar)
25import qualified Control.Concurrent.MVar as M
25import qualified Control.Concurrent.MVar as M
26
26
27import Effectful.Concurrent.Effect
27import Effectful.Concurrent.Effect
28−import Effectful.Internal.Effect
28+import Effectful.Dispatch.Static
29−import Effectful.Internal.Monad
29+import Effectful.Monad
30
30
31-- | Lifted 'M.newEmptyMVar'.
31-- | Lifted 'M.newEmptyMVar'.
32newEmptyMVar :: Concurrent :> es => Eff es (MVar a)
32newEmptyMVar :: Concurrent :> es => Eff es (MVar a)
effectful/src/Effectful/Concurrent/QSem.hs+2−2
@@ -10,8 +10,8 @@ import Control.Concurrent.QSem (QSem)
10import qualified Control.Concurrent.QSem as Q
10import qualified Control.Concurrent.QSem as Q
11
11
12import Effectful.Concurrent.Effect
12import Effectful.Concurrent.Effect
13−import Effectful.Internal.Effect
13+import Effectful.Dispatch.Static
14−import Effectful.Internal.Monad
14+import Effectful.Monad
15
15
16-- | Lifted 'Q.newQSem'.
16-- | Lifted 'Q.newQSem'.
17newQSem :: Concurrent :> es => Int -> Eff es QSem
17newQSem :: Concurrent :> es => Int -> Eff es QSem
effectful/src/Effectful/Concurrent/QSemN.hs+2−2
@@ -10,8 +10,8 @@ import Control.Concurrent.QSemN (QSemN)
10import qualified Control.Concurrent.QSemN as Q
10import qualified Control.Concurrent.QSemN as Q
11
11
12import Effectful.Concurrent.Effect
12import Effectful.Concurrent.Effect
13−import Effectful.Internal.Effect
13+import Effectful.Dispatch.Static
14−import Effectful.Internal.Monad
14+import Effectful.Monad
15
15
16-- | Lifted 'Q.newQSemN'.
16-- | Lifted 'Q.newQSemN'.
17newQSemN :: Concurrent :> es => Int -> Eff es QSemN
17newQSemN :: Concurrent :> es => Int -> Eff es QSemN
effectful/src/Effectful/Concurrent/STM.hs+2−2
@@ -89,8 +89,8 @@ import System.Mem.Weak (Weak)
89import GHC.Natural (Natural)
89import GHC.Natural (Natural)
90
90
91import Effectful.Concurrent.Effect
91import Effectful.Concurrent.Effect
92−import Effectful.Internal.Effect
92+import Effectful.Dispatch.Static
93−import Effectful.Internal.Monad
93+import Effectful.Monad
94
94
95-- | Lifted version of 'STM.atomically'
95-- | Lifted version of 'STM.atomically'
96atomically :: Concurrent :> es => STM a -> Eff es a
96atomically :: Concurrent :> es => STM a -> Eff es a
effectful/src/Effectful/Environment.hs+2−2
@@ -20,8 +20,8 @@ module Effectful.Environment
20
20
21import qualified System.Environment as E
21import qualified System.Environment as E
22
22
23−import Effectful.Internal.Effect
23+import Effectful.Dispatch.Static hiding (getEnv)
24−import Effectful.Internal.Monad
24+import Effectful.Monad
25
25
26-- | An effect for querying and modifying the system environment.
26-- | An effect for querying and modifying the system environment.
27data Environment :: Effect where
27data Environment :: Effect where
effectful/src/Effectful/FileSystem.hs+2−2
@@ -91,8 +91,8 @@ module Effectful.FileSystem
91import Data.Time (UTCTime)
91import Data.Time (UTCTime)
92import qualified System.Directory as D
92import qualified System.Directory as D
93
93
94−import Effectful.Internal.Effect
94+import Effectful.Dispatch.Static
95−import Effectful.Internal.Monad
95+import Effectful.Monad
96
96
97-- | An effect for interacting with the filesystem.
97-- | An effect for interacting with the filesystem.
98data FileSystem :: Effect where
98data FileSystem :: Effect where
effectful/src/Effectful/Process.hs+2−2
@@ -51,8 +51,8 @@ import System.IO (Handle)
51import System.Posix.Internals (FD)
51import System.Posix.Internals (FD)
52import qualified System.Process as P
52import qualified System.Process as P
53
53
54−import Effectful.Internal.Effect
54+import Effectful.Dispatch.Static
55−import Effectful.Internal.Monad
55+import Effectful.Monad
56
56
57-- | An effect for running child processes using the @process@ library.
57-- | An effect for running child processes using the @process@ library.
58data Process :: Effect where
58data Process :: Effect where
effectful/src/Effectful/Resource.hs+2−3
@@ -24,9 +24,8 @@ import Control.Exception
24import qualified Control.Monad.Trans.Resource as R
24import qualified Control.Monad.Trans.Resource as R
25import qualified Control.Monad.Trans.Resource.Internal as RI
25import qualified Control.Monad.Trans.Resource.Internal as RI
26
26
27−import Effectful.Internal.Effect
27+import Effectful.Dispatch.Static
28−import Effectful.Internal.Env
29−import Effectful.Internal.Monad
28+import Effectful.Monad
30
29
31-- | Data tag for a resource effect.
30-- | Data tag for a resource effect.
32newtype Resource :: Effect where
31newtype Resource :: Effect where
effectful/src/Effectful/Temporary.hs+2−2
@@ -10,8 +10,8 @@ module Effectful.Temporary
10import System.IO
10import System.IO
11import qualified UnliftIO.Temporary as T
11import qualified UnliftIO.Temporary as T
12
12
13−import Effectful.Internal.Effect
13+import Effectful.Dispatch.Static
14−import Effectful.Internal.Monad
14+import Effectful.Monad
15
15
16-- | An effect for interacting with temporary files.
16-- | An effect for interacting with temporary files.
17data Temporary :: Effect where
17data Temporary :: Effect where
effectful/src/Effectful/Timeout.hs+2−2
@@ -6,8 +6,8 @@ module Effectful.Timeout
6
6
7import qualified System.Timeout as T
7import qualified System.Timeout as T
8
8
9−import Effectful.Internal.Effect
9+import Effectful.Dispatch.Static
10−import Effectful.Internal.Monad
10+import Effectful.Monad
11
11
12-- | An effect for timing out computations.
12-- | An effect for timing out computations.
13data Timeout :: Effect where
13data Timeout :: Effect where