on master help sign in
Add lower bounds for deps and improve haddock a bit
0363e15Andrzej Rybczak
effectful-core/effectful-core.cabal+11−9
@@ -66,18 +66,20 @@ library
66
66
67 ghc-options: -O2
67 ghc-options: -O2
68
68
69− build-depends: base >= 4.13 && <5
69+ build-depends: effectful-internal-utils
70+
71+ build-depends: base >= 4.13 && < 5
70− , containers
72+ , containers >= 0.6.5.1
71− , effectful-internal-utils
72− , exceptions
73+ , exceptions >= 0.10.4
73− , monad-control
74+ , monad-control >= 1.0.3
74− , primitive
75+ , primitive >= 0.7.3.0
75− , transformers-base
76+ , transformers-base >= 0.4.6
76− , unliftio-core
77+ , unliftio-core >= 0.2.0.1
77
78
78 hs-source-dirs: src
79 hs-source-dirs: src
79
80
80− exposed-modules: Effectful.Dispatch.Dynamic
81+ exposed-modules: Effectful
82+ Effectful.Dispatch.Dynamic
81 Effectful.Dispatch.Static
83 Effectful.Dispatch.Static
82 Effectful.Error
84 Effectful.Error
83 Effectful.Error.Dynamic
85 Effectful.Error.Dynamic
effectful/src/Effectful.hs → effectful-core/src/Effectful.hsrenamed

The content is the same.

effectful-core/src/Effectful/Dispatch/Static.hs+4
@@ -14,6 +14,10 @@ module Effectful.Dispatch.Static
14 , stateEffectM
14 , stateEffectM
15 , localEffect
15 , localEffect
16
16
17+ -- ** Unlifts
18+ , seqUnliftIO
19+ , concUnliftIO
20+
17 -- * Primitive API
21 -- * Primitive API
18 , Env
22 , Env
19 , Relinker(..)
23 , Relinker(..)
effectful-core/src/Effectful/Internal/Env.hs+8−8
@@ -68,17 +68,17 @@ type role Env nominal
68-- @
68-- @
69--
69--
70-- The point of execution is currently at (*), i.e. the mainline. Moreover,
70-- The point of execution is currently at (*), i.e. the mainline. Moreover,
71−-- currently:
71+-- currently (brackets represent forks):
72--
72--
73-- - Mainline sees @[e00, e01, e05, e07]@.
73-- - Mainline sees @[e00, e01, e05, e07]@.
74--
74--
75−-- - @e01@ is an interpreted effect, its handler sees @[e00, e02, e03]@.
75+-- - @e01@ is an interpreted effect, its handler sees @[e00][e02, e03]@.
76--
76--
77−-- - @e03@ is an interpreted effect, its handler sees @[e00, e02, e04]@.
77+-- - @e03@ is an interpreted effect, its handler sees @[e00][e02][e04]@.
78--
78--
79−-- - @e05@ is an interpreted effect, its handler sees @[e00, e01, e06]@.
79+-- - @e05@ is an interpreted effect, its handler sees @[e00, e01][e06]@.
80--
80--
81−-- - @e07@ is an interpreted effect, its handler sees @[e00, e01, e05, e08,
81+-- - @e07@ is an interpreted effect, its handler sees @[e00, e01, e05][e08,
82-- e09]@.
82-- e09]@.
83--
83--
84-- If an operation from @e01@ is invoked, the environment in the middle of
84-- If an operation from @e01@ is invoked, the environment in the middle of
@@ -101,11 +101,11 @@ type role Env nominal
101-- introduced @e12@), so its local environment was temporarily extended with
101-- introduced @e12@), so its local environment was temporarily extended with
102-- it. Moreover, currently:
102-- it. Moreover, currently:
103--
103--
104−-- - Handler of @e01@ sees @[e00, e02, e03, e10]@.
104+-- - Handler of @e01@ sees @[e00][e02, e03, e10]@.
105--
105--
106−-- - Handler of @e10@ sees @[e00, e02, e03, e11]@.
106+-- - Handler of @e10@ sees @[e00][e02, e03][e11]@.
107--
107--
108−-- - Handler of @e11@ sees @[e00, e02, e03, e12]@.
108+-- - Handler of @e11@ sees @[e00][e02, e03][e12]@.
109--
109--
110data Env (es :: [Effect]) = Env
110data Env (es :: [Effect]) = Env
111 { _forks :: !Forks
111 { _forks :: !Forks
effectful-core/src/Effectful/Internal/Monad.hs+6−2
@@ -175,21 +175,25 @@ withEffToIO f = unliftStrategy >>= \case
175 ConcUnlift p b -> withUnliftStrategy SeqUnlift $ do
175 ConcUnlift p b -> withUnliftStrategy SeqUnlift $ do
176 unsafeEff $ \es -> concUnliftIO es p b f
176 unsafeEff $ \es -> concUnliftIO es p b f
177
177
178−-- | Lower 'Eff' operations into 'IO' ('SeqUnlift').
178+-- | Create an unlifting function with the 'SeqUnlift' strategy.
179seqUnliftIO
179seqUnliftIO
180 :: HasCallStack
180 :: HasCallStack
181 => Env es
181 => Env es
182+ -- ^ The environment.
182 -> ((forall r. Eff es r -> IO r) -> IO a)
183 -> ((forall r. Eff es r -> IO r) -> IO a)
184+ -- ^ Continuation with the unlifting function in scope.
183 -> IO a
185 -> IO a
184seqUnliftIO es k = seqUnlift k es unEff
186seqUnliftIO es k = seqUnlift k es unEff
185
187
186−-- | Lower 'Eff' operations into 'IO' ('ConcUnlift').
188+-- | Create an unlifting function with the 'ConcUnlift' strategy.
187concUnliftIO
189concUnliftIO
188 :: HasCallStack
190 :: HasCallStack
189 => Env es
191 => Env es
192+ -- ^ The environment.
190 -> Persistence
193 -> Persistence
191 -> Limit
194 -> Limit
192 -> ((forall r. Eff es r -> IO r) -> IO a)
195 -> ((forall r. Eff es r -> IO r) -> IO a)
196+ -- ^ Continuation with the unlifting function in scope.
193 -> IO a
197 -> IO a
194concUnliftIO es persistence limit k = concUnlift persistence limit k es unEff
198concUnliftIO es persistence limit k = concUnlift persistence limit k es unEff
195
199
effectful/effectful.cabal+12−12
@@ -60,20 +60,19 @@ common language
60library
60library
61 import: language
61 import: language
62
62
63− build-depends: base >= 4.13 && <5
63+ build-depends: base >= 4.13 && < 5
64− , async
64+ , async >= 2.2.2
65− , directory
65+ , directory >= 1.3.7.0
66− , effectful-core >= 0.1 && <0.1.1
66+ , effectful-core >= 0.1 && < 0.1.1
67− , process
67+ , process >= 1.6.12
68− , resourcet
68+ , resourcet >= 1.2.4.3
69− , time
69+ , time >= 1.9.2
70− , stm >= 2.5.0.0
70+ , stm >= 2.5.0.2
71− , unliftio
71+ , unliftio >= 0.2.20
72
72
73 hs-source-dirs: src
73 hs-source-dirs: src
74
74
75− exposed-modules: Effectful
75+ exposed-modules: Effectful.Concurrent
76− Effectful.Concurrent
77 Effectful.Concurrent.Async
76 Effectful.Concurrent.Async
78 Effectful.Concurrent.Chan
77 Effectful.Concurrent.Chan
79 Effectful.Concurrent.MVar
78 Effectful.Concurrent.MVar
@@ -91,7 +90,8 @@ library
91 other-modules: Effectful.Concurrent.Effect
90 other-modules: Effectful.Concurrent.Effect
92 Effectful.FileSystem.Effect
91 Effectful.FileSystem.Effect
93
92
94− reexported-modules: Effectful.Dispatch.Dynamic
93+ reexported-modules: Effectful
94+ , Effectful.Dispatch.Dynamic
95 , Effectful.Dispatch.Static
95 , Effectful.Dispatch.Static
96 , Effectful.Error
96 , Effectful.Error
97 , Effectful.Error.Dynamic
97 , Effectful.Error.Dynamic
effectful/src/Effectful/Concurrent.hs+1−1
@@ -1,5 +1,5 @@
1module Effectful.Concurrent
1module Effectful.Concurrent
2− ( -- * Concurrent effect
2+ ( -- * The effect
3 Concurrent
3 Concurrent
4 , runConcurrent
4 , runConcurrent
5
5
effectful/src/Effectful/Concurrent/Async.hs+1−1
@@ -1,6 +1,6 @@
1{-# LANGUAGE UndecidableInstances #-}
1{-# LANGUAGE UndecidableInstances #-}
2module Effectful.Concurrent.Async
2module Effectful.Concurrent.Async
3− ( -- * Concurrent effect
3+ ( -- * The effect
4 Concurrent
4 Concurrent
5 , runConcurrent
5 , runConcurrent
6
6
effectful/src/Effectful/Concurrent/Chan.hs+6−1
@@ -1,6 +1,11 @@
1-- | Lifted version of "Control.Concurrent.Chan".
1-- | Lifted version of "Control.Concurrent.Chan".
2module Effectful.Concurrent.Chan
2module Effectful.Concurrent.Chan
3+ ( -- * The effect
4+ Concurrent
5+ , runConcurrent
6+
7+ -- * Chan
3− ( Chan
8+ , Chan
4 , newChan
9 , newChan
5 , writeChan
10 , writeChan
6 , readChan
11 , readChan
effectful/src/Effectful/Concurrent/Effect.hs+1
@@ -15,5 +15,6 @@ import Effectful.Monad
15data Concurrent :: Effect where
15data Concurrent :: Effect where
16 Concurrent :: Concurrent m r
16 Concurrent :: Concurrent m r
17
17
18+-- | Run the 'Concurrent' effect.
18runConcurrent :: IOE :> es => Eff (Concurrent : es) a -> Eff es a
19runConcurrent :: IOE :> es => Eff (Concurrent : es) a -> Eff es a
19runConcurrent = evalEffect (IdE Concurrent)
20runConcurrent = evalEffect (IdE Concurrent)
effectful/src/Effectful/Concurrent/MVar.hs+6−1
@@ -1,6 +1,11 @@
1-- | Lifted version of "Control.Concurrent.MVar".
1-- | Lifted version of "Control.Concurrent.MVar".
2module Effectful.Concurrent.MVar
2module Effectful.Concurrent.MVar
3+ ( -- * The effect
4+ Concurrent
5+ , runConcurrent
6+
7+ -- * MVar
3− ( MVar
8+ , MVar
4 , newEmptyMVar
9 , newEmptyMVar
5 , newMVar
10 , newMVar
6 , takeMVar
11 , takeMVar
effectful/src/Effectful/Concurrent/QSem.hs+6−1
@@ -1,6 +1,11 @@
1-- | Lifted "Control.Concurrent.QSem".
1-- | Lifted "Control.Concurrent.QSem".
2module Effectful.Concurrent.QSem
2module Effectful.Concurrent.QSem
3+ ( -- * The effect
4+ Concurrent
5+ , runConcurrent
6+
7+ -- * QSem
3− ( QSem
8+ , QSem
4 , newQSem
9 , newQSem
5 , waitQSem
10 , waitQSem
6 , signalQSem
11 , signalQSem
effectful/src/Effectful/Concurrent/QSemN.hs+6−1
@@ -1,6 +1,11 @@
1-- | Lifted "Control.Concurrent.QSemN".
1-- | Lifted "Control.Concurrent.QSemN".
2module Effectful.Concurrent.QSemN
2module Effectful.Concurrent.QSemN
3+ ( -- * The effect
4+ Concurrent
5+ , runConcurrent
6+
7+ -- * QSemN
3− ( QSemN
8+ , QSemN
4 , newQSemN
9 , newQSemN
5 , waitQSemN
10 , waitQSemN
6 , signalQSemN
11 , signalQSemN
effectful/src/Effectful/Concurrent/STM.hs+6−2
@@ -1,7 +1,11 @@
1-- | Lifted version of "Control.Concurrent.STM".
1-- | Lifted version of "Control.Concurrent.STM".
2module Effectful.Concurrent.STM
2module Effectful.Concurrent.STM
3+ ( -- * The effect
4+ Concurrent
5+ , runConcurrent
6+
3− ( -- * Core
7+ -- * Core
4− STM.STM
8+ , STM.STM
5 , atomically
9 , atomically
6 , STM.retry
10 , STM.retry
7 , STM.orElse
11 , STM.orElse
effectful/src/Effectful/Environment.hs+2−1
@@ -1,5 +1,5 @@
1module Effectful.Environment
1module Effectful.Environment
2− ( -- * Environment effect
2+ ( -- * The effect
3 Environment
3 Environment
4 , runEnvironment
4 , runEnvironment
5
5
@@ -27,6 +27,7 @@ import Effectful.Monad
27data Environment :: Effect where
27data Environment :: Effect where
28 Environment :: Environment m r
28 Environment :: Environment m r
29
29
30+-- | Run the 'Environment' effect.
30runEnvironment :: IOE :> es => Eff (Environment : es) a -> Eff es a
31runEnvironment :: IOE :> es => Eff (Environment : es) a -> Eff es a
31runEnvironment = evalEffect (IdE Environment)
32runEnvironment = evalEffect (IdE Environment)
32
33
effectful/src/Effectful/FileSystem.hs+2−1
@@ -1,5 +1,6 @@
1module Effectful.FileSystem
1module Effectful.FileSystem
2+ ( -- * The effect
2− ( FileSystem
3+ FileSystem
3 , runFileSystem
4 , runFileSystem
4
5
5 -- * Actions on directories
6 -- * Actions on directories
effectful/src/Effectful/FileSystem/IO.hs+4−1
@@ -1,7 +1,10 @@
1-- | Lifted version of "System.IO".
1-- | Lifted version of "System.IO".
2module Effectful.FileSystem.IO
2module Effectful.FileSystem.IO
3+ ( -- * The effect
3− ( FileSystem
4+ FileSystem
4 , runFileSystem
5 , runFileSystem
6+
7+ -- * IO
5 , IOMode (..)
8 , IOMode (..)
6 , Handle
9 , Handle
7 , IO.stdin
10 , IO.stdin
effectful/src/Effectful/Process.hs+2−7
@@ -1,7 +1,6 @@
1−{-# LANGUAGE CPP #-}
1+-- | Lifted version of "System.Process".
2−
3module Effectful.Process
2module Effectful.Process
4− ( -- * Process effect
3+ ( -- * The effect
5 Process
4 Process
6 , runProcess
5 , runProcess
7
6
@@ -31,9 +30,7 @@ module Effectful.Process
31 , P.showCommandForUser
30 , P.showCommandForUser
32 , P.Pid
31 , P.Pid
33 , getPid
32 , getPid
34−#if MIN_VERSION_process(1,6,12)
35 , getCurrentPid
33 , getCurrentPid
36−#endif
37
34
38 -- * Process completion
35 -- * Process completion
39 , waitForProcess
36 , waitForProcess
@@ -146,11 +143,9 @@ cleanupProcess = unsafeEff_ . P.cleanupProcess
146getPid :: Process :> es => P.ProcessHandle -> Eff es (Maybe P.Pid)
143getPid :: Process :> es => P.ProcessHandle -> Eff es (Maybe P.Pid)
147getPid = unsafeEff_ . P.getPid
144getPid = unsafeEff_ . P.getPid
148
145
149−#if MIN_VERSION_process(1,6,12)
150-- | Lifted 'P.getCurrentPid'.
146-- | Lifted 'P.getCurrentPid'.
151getCurrentPid :: Process :> es => Eff es P.Pid
147getCurrentPid :: Process :> es => Eff es P.Pid
152getCurrentPid = unsafeEff_ P.getCurrentPid
148getCurrentPid = unsafeEff_ P.getCurrentPid
153−#endif
154
149
155----------------------------------------
150----------------------------------------
156-- Process completion
151-- Process completion