Skip to content

Commit 54b3238

Browse files
committed
rename Promise -> Future
1 parent c3aace4 commit 54b3238

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎unfork/Unfork.hs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Unfork
33
-- * Asynchronous I/O
44
unforkAsyncVoidIO,
55
unforkAsyncIO,
6-
Promise (..),
6+
Future (..),
77
-- * Asynchronous STM
88
unforkAsyncVoidSTM,
99
unforkAsyncSTM,
@@ -119,7 +119,7 @@ unforkAsyncSTM action =
119119
unforkAsyncIO ::
120120
(task -> IO result)
121121
-- ^ Action that needs to be run serially
122-
-> ((task -> IO (Promise result)) -> IO conclusion)
122+
-> ((task -> IO (Future result)) -> IO conclusion)
123123
-- ^ Continuation with a thread-safe version of the action
124124
-> IO conclusion
125125
unforkAsyncIO action =
@@ -128,7 +128,7 @@ unforkAsyncIO action =
128128
threadSafeAction run arg = do
129129
resultVar <- newEmptyMVar
130130
atomically (enqueue run Task{ arg, resultVar })
131-
pure (Promise{ block = readMVar resultVar, peek = tryReadMVar resultVar })
131+
pure (Future{ await = readMVar resultVar, peek = tryReadMVar resultVar })
132132
step Task{ arg, resultVar } = do
133133
b <- action arg
134134
putMVar resultVar b
@@ -188,7 +188,7 @@ data Task a b = Task{ arg :: !a, resultVar :: !b }
188188

189189
data Run q = Run{ queue :: !(TQueue q), stopper :: !(TVar Bool) }
190190

191-
data Promise result = Promise{ block :: IO result, peek :: IO (Maybe result) }
191+
data Future result = Future{ await :: IO result, peek :: IO (Maybe result) }
192192

193193
data Lock = Lock
194194

0 commit comments

Comments
 (0)