on master help sign in
Add lower bounds for deps and improve haddock a bit
commit0363e15c0eb734a53ab3cb595d6fcc09790bfdb1 authorAndrzej Rybczak <andrzej@rybczak.net> dateThu 16 Dec 2021, 17:13 (5 years ago) parent78f0b4b
18 files changed+84−49
effectful-core/effectful-core.cabal+11−9 effectful/src/Effectful.hs → effectful-core/src/Effectful.hs effectful-core/src/Effectful/Dispatch/Static.hs+4 effectful-core/src/Effectful/Internal/Env.hs+8−8 effectful-core/src/Effectful/Internal/Monad.hs+6−2 effectful/effectful.cabal+12−12 effectful/src/Effectful/Concurrent.hs+1−1 effectful/src/Effectful/Concurrent/Async.hs+1−1 effectful/src/Effectful/Concurrent/Chan.hs+6−1 effectful/src/Effectful/Concurrent/Effect.hs+1 effectful/src/Effectful/Concurrent/MVar.hs+6−1 effectful/src/Effectful/Concurrent/QSem.hs+6−1 effectful/src/Effectful/Concurrent/QSemN.hs+6−1 effectful/src/Effectful/Concurrent/STM.hs+6−2 effectful/src/Effectful/Environment.hs+2−1 effectful/src/Effectful/FileSystem.hs+2−1 effectful/src/Effectful/FileSystem/IO.hs+4−1 effectful/src/Effectful/Process.hs+2−7
effectful-core/effectful-core.cabal+11−9
@@ -66,18 +66,20 @@ library
6666
6767 ghc-options: -O2
6868
69− build-depends: base >= 4.13 && <5
70− , containers
71− , effectful-internal-utils
72− , exceptions
73− , monad-control
74− , primitive
75− , transformers-base
76− , unliftio-core
69+ build-depends: effectful-internal-utils
70+
71+ build-depends: base >= 4.13 && < 5
72+ , containers >= 0.6.5.1
73+ , exceptions >= 0.10.4
74+ , monad-control >= 1.0.3
75+ , primitive >= 0.7.3.0
76+ , transformers-base >= 0.4.6
77+ , unliftio-core >= 0.2.0.1
7778
7879 hs-source-dirs: src
7980
80− exposed-modules: Effectful.Dispatch.Dynamic
81+ exposed-modules: Effectful
82+ Effectful.Dispatch.Dynamic
8183 Effectful.Dispatch.Static
8284 Effectful.Error
8385 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
1414 , stateEffectM
1515 , localEffect
1616
17+ -- ** Unlifts
18+ , seqUnliftIO
19+ , concUnliftIO
20+
1721 -- * Primitive API
1822 , Env
1923 , Relinker(..)
effectful-core/src/Effectful/Internal/Env.hs+8−8
@@ -68,17 +68,17 @@ type role Env nominal
6868-- @
6969--
7070-- The point of execution is currently at (*), i.e. the mainline. Moreover,
71−-- currently:
71+-- currently (brackets represent forks):
7272--
7373-- - Mainline sees @[e00, e01, e05, e07]@.
7474--
75−-- - @e01@ is an interpreted effect, its handler sees @[e00, e02, e03]@.
75+-- - @e01@ is an interpreted effect, its handler sees @[e00][e02, e03]@.
7676--
77−-- - @e03@ is an interpreted effect, its handler sees @[e00, e02, e04]@.
77+-- - @e03@ is an interpreted effect, its handler sees @[e00][e02][e04]@.
7878--
79−-- - @e05@ is an interpreted effect, its handler sees @[e00, e01, e06]@.
79+-- - @e05@ is an interpreted effect, its handler sees @[e00, e01][e06]@.
8080--
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,
8282-- e09]@.
8383--
8484-- If an operation from @e01@ is invoked, the environment in the middle of
@@ -101,11 +101,11 @@ type role Env nominal
101101-- introduced @e12@), so its local environment was temporarily extended with
102102-- it. Moreover, currently:
103103--
104−-- - Handler of @e01@ sees @[e00, e02, e03, e10]@.
104+-- - Handler of @e01@ sees @[e00][e02, e03, e10]@.
105105--
106−-- - Handler of @e10@ sees @[e00, e02, e03, e11]@.
106+-- - Handler of @e10@ sees @[e00][e02, e03][e11]@.
107107--
108−-- - Handler of @e11@ sees @[e00, e02, e03, e12]@.
108+-- - Handler of @e11@ sees @[e00][e02, e03][e12]@.
109109--
110110data Env (es :: [Effect]) = Env
111111 { _forks :: !Forks
effectful-core/src/Effectful/Internal/Monad.hs+6−2
@@ -175,21 +175,25 @@ withEffToIO f = unliftStrategy >>= \case
175175 ConcUnlift p b -> withUnliftStrategy SeqUnlift $ do
176176 unsafeEff $ \es -> concUnliftIO es p b f
177177
178−-- | Lower 'Eff' operations into 'IO' ('SeqUnlift').
178+-- | Create an unlifting function with the 'SeqUnlift' strategy.
179179seqUnliftIO
180180 :: HasCallStack
181181 => Env es
182+ -- ^ The environment.
182183 -> ((forall r. Eff es r -> IO r) -> IO a)
184+ -- ^ Continuation with the unlifting function in scope.
183185 -> IO a
184186seqUnliftIO es k = seqUnlift k es unEff
185187
186−-- | Lower 'Eff' operations into 'IO' ('ConcUnlift').
188+-- | Create an unlifting function with the 'ConcUnlift' strategy.
187189concUnliftIO
188190 :: HasCallStack
189191 => Env es
192+ -- ^ The environment.
190193 -> Persistence
191194 -> Limit
192195 -> ((forall r. Eff es r -> IO r) -> IO a)
196+ -- ^ Continuation with the unlifting function in scope.
193197 -> IO a
194198concUnliftIO es persistence limit k = concUnlift persistence limit k es unEff
195199
effectful/effectful.cabal+12−12
@@ -60,20 +60,19 @@ common language
6060library
6161 import: language
6262
63− build-depends: base >= 4.13 && <5
64− , async
65− , directory
66− , effectful-core >= 0.1 && <0.1.1
67− , process
68− , resourcet
69− , time
70− , stm >= 2.5.0.0
71− , unliftio
63+ build-depends: base >= 4.13 && < 5
64+ , async >= 2.2.2
65+ , directory >= 1.3.7.0
66+ , effectful-core >= 0.1 && < 0.1.1
67+ , process >= 1.6.12
68+ , resourcet >= 1.2.4.3
69+ , time >= 1.9.2
70+ , stm >= 2.5.0.2
71+ , unliftio >= 0.2.20
7272
7373 hs-source-dirs: src
7474
75− exposed-modules: Effectful
76− Effectful.Concurrent
75+ exposed-modules: Effectful.Concurrent
7776 Effectful.Concurrent.Async
7877 Effectful.Concurrent.Chan
7978 Effectful.Concurrent.MVar
@@ -91,7 +90,8 @@ library
9190 other-modules: Effectful.Concurrent.Effect
9291 Effectful.FileSystem.Effect
9392
94− reexported-modules: Effectful.Dispatch.Dynamic
93+ reexported-modules: Effectful
94+ , Effectful.Dispatch.Dynamic
9595 , Effectful.Dispatch.Static
9696 , Effectful.Error
9797 , Effectful.Error.Dynamic
effectful/src/Effectful/Concurrent.hs+1−1
@@ -1,5 +1,5 @@
11module Effectful.Concurrent
2− ( -- * Concurrent effect
2+ ( -- * The effect
33 Concurrent
44 , runConcurrent
55
effectful/src/Effectful/Concurrent/Async.hs+1−1
@@ -1,6 +1,6 @@
11{-# LANGUAGE UndecidableInstances #-}
22module Effectful.Concurrent.Async
3− ( -- * Concurrent effect
3+ ( -- * The effect
44 Concurrent
55 , runConcurrent
66
effectful/src/Effectful/Concurrent/Chan.hs+6−1
@@ -1,6 +1,11 @@
11-- | Lifted version of "Control.Concurrent.Chan".
22module Effectful.Concurrent.Chan
3− ( Chan
3+ ( -- * The effect
4+ Concurrent
5+ , runConcurrent
6+
7+ -- * Chan
8+ , Chan
49 , newChan
510 , writeChan
611 , readChan
effectful/src/Effectful/Concurrent/Effect.hs+1
@@ -15,5 +15,6 @@ import Effectful.Monad
1515data Concurrent :: Effect where
1616 Concurrent :: Concurrent m r
1717
18+-- | Run the 'Concurrent' effect.
1819runConcurrent :: IOE :> es => Eff (Concurrent : es) a -> Eff es a
1920runConcurrent = evalEffect (IdE Concurrent)
effectful/src/Effectful/Concurrent/MVar.hs+6−1
@@ -1,6 +1,11 @@
11-- | Lifted version of "Control.Concurrent.MVar".
22module Effectful.Concurrent.MVar
3− ( MVar
3+ ( -- * The effect
4+ Concurrent
5+ , runConcurrent
6+
7+ -- * MVar
8+ , MVar
49 , newEmptyMVar
510 , newMVar
611 , takeMVar
effectful/src/Effectful/Concurrent/QSem.hs+6−1
@@ -1,6 +1,11 @@
11-- | Lifted "Control.Concurrent.QSem".
22module Effectful.Concurrent.QSem
3− ( QSem
3+ ( -- * The effect
4+ Concurrent
5+ , runConcurrent
6+
7+ -- * QSem
8+ , QSem
49 , newQSem
510 , waitQSem
611 , signalQSem
effectful/src/Effectful/Concurrent/QSemN.hs+6−1
@@ -1,6 +1,11 @@
11-- | Lifted "Control.Concurrent.QSemN".
22module Effectful.Concurrent.QSemN
3− ( QSemN
3+ ( -- * The effect
4+ Concurrent
5+ , runConcurrent
6+
7+ -- * QSemN
8+ , QSemN
49 , newQSemN
510 , waitQSemN
611 , signalQSemN
effectful/src/Effectful/Concurrent/STM.hs+6−2
@@ -1,7 +1,11 @@
11-- | Lifted version of "Control.Concurrent.STM".
22module Effectful.Concurrent.STM
3− ( -- * Core
4− STM.STM
3+ ( -- * The effect
4+ Concurrent
5+ , runConcurrent
6+
7+ -- * Core
8+ , STM.STM
59 , atomically
610 , STM.retry
711 , STM.orElse
effectful/src/Effectful/Environment.hs+2−1
@@ -1,5 +1,5 @@
11module Effectful.Environment
2− ( -- * Environment effect
2+ ( -- * The effect
33 Environment
44 , runEnvironment
55
@@ -27,6 +27,7 @@ import Effectful.Monad
2727data Environment :: Effect where
2828 Environment :: Environment m r
2929
30+-- | Run the 'Environment' effect.
3031runEnvironment :: IOE :> es => Eff (Environment : es) a -> Eff es a
3132runEnvironment = evalEffect (IdE Environment)
3233
effectful/src/Effectful/FileSystem.hs+2−1
@@ -1,5 +1,6 @@
11module Effectful.FileSystem
2− ( FileSystem
2+ ( -- * The effect
3+ FileSystem
34 , runFileSystem
45
56 -- * Actions on directories
effectful/src/Effectful/FileSystem/IO.hs+4−1
@@ -1,7 +1,10 @@
11-- | Lifted version of "System.IO".
22module Effectful.FileSystem.IO
3− ( FileSystem
3+ ( -- * The effect
4+ FileSystem
45 , runFileSystem
6+
7+ -- * IO
58 , IOMode (..)
69 , Handle
710 , IO.stdin
effectful/src/Effectful/Process.hs+2−7
@@ -1,7 +1,6 @@
1−{-# LANGUAGE CPP #-}
2−
1+-- | Lifted version of "System.Process".
32module Effectful.Process
4− ( -- * Process effect
3+ ( -- * The effect
54 Process
65 , runProcess
76
@@ -31,9 +30,7 @@ module Effectful.Process
3130 , P.showCommandForUser
3231 , P.Pid
3332 , getPid
34−#if MIN_VERSION_process(1,6,12)
3533 , getCurrentPid
36−#endif
3734
3835 -- * Process completion
3936 , waitForProcess
@@ -146,11 +143,9 @@ cleanupProcess = unsafeEff_ . P.cleanupProcess
146143getPid :: Process :> es => P.ProcessHandle -> Eff es (Maybe P.Pid)
147144getPid = unsafeEff_ . P.getPid
148145
149−#if MIN_VERSION_process(1,6,12)
150146-- | Lifted 'P.getCurrentPid'.
151147getCurrentPid :: Process :> es => Eff es P.Pid
152148getCurrentPid = unsafeEff_ P.getCurrentPid
153−#endif
154149
155150----------------------------------------
156151-- Process completion