Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
quasar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jens Nolte
quasar
Commits
59bc7df0
Commit
59bc7df0
authored
3 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Sort export lists
parent
83377f66
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Quasar/Awaitable.hs
+19
-17
19 additions, 17 deletions
src/Quasar/Awaitable.hs
src/Quasar/Disposable.hs
+7
-5
7 additions, 5 deletions
src/Quasar/Disposable.hs
with
26 additions
and
22 deletions
src/Quasar/Awaitable.hs
+
19
−
17
View file @
59bc7df0
module
Quasar.Awaitable
(
module
Quasar.Awaitable
(
-- * Awaitable
-- *
Monad
Awaitable
MonadAwait
(
..
),
MonadAwait
(
..
),
IsAwaitable
(
..
),
Awaitable
,
awaitResult
,
awaitResult
,
peekAwaitable
,
peekAwaitable
,
-- * Awaitable
IsAwaitable
(
..
),
Awaitable
,
successfulAwaitable
,
successfulAwaitable
,
failedAwaitable
,
failedAwaitable
,
completedAwaitable
,
completedAwaitable
,
...
@@ -58,20 +60,6 @@ import Data.Sequence
...
@@ -58,20 +60,6 @@ import Data.Sequence
import
Quasar.Prelude
import
Quasar.Prelude
class
IsAwaitable
r
a
|
a
->
r
where
runAwaitable
::
(
MonadQuerySTM
m
)
=>
a
->
m
r
runAwaitable
self
=
runAwaitable
(
toAwaitable
self
)
cacheAwaitable
::
MonadIO
m
=>
a
->
m
(
Awaitable
r
)
cacheAwaitable
self
=
cacheAwaitable
(
toAwaitable
self
)
toAwaitable
::
a
->
Awaitable
r
toAwaitable
=
Awaitable
{-# MINIMAL toAwaitable | (runAwaitable, cacheAwaitable) #-}
class
(
MonadCatch
m
,
MonadPlus
m
)
=>
MonadAwait
m
where
class
(
MonadCatch
m
,
MonadPlus
m
)
=>
MonadAwait
m
where
await
::
IsAwaitable
r
a
=>
a
->
m
r
await
::
IsAwaitable
r
a
=>
a
->
m
r
...
@@ -95,6 +83,20 @@ peekAwaitable awaitable = liftIO $ runMaybeT $ runQueryT queryFn (runAwaitable a
...
@@ -95,6 +83,20 @@ peekAwaitable awaitable = liftIO $ runMaybeT $ runQueryT queryFn (runAwaitable a
queryFn
transaction
=
MaybeT
$
atomically
$
(
Just
<$>
transaction
)
`
orElse
`
pure
Nothing
queryFn
transaction
=
MaybeT
$
atomically
$
(
Just
<$>
transaction
)
`
orElse
`
pure
Nothing
class
IsAwaitable
r
a
|
a
->
r
where
runAwaitable
::
(
MonadQuerySTM
m
)
=>
a
->
m
r
runAwaitable
self
=
runAwaitable
(
toAwaitable
self
)
cacheAwaitable
::
MonadIO
m
=>
a
->
m
(
Awaitable
r
)
cacheAwaitable
self
=
cacheAwaitable
(
toAwaitable
self
)
toAwaitable
::
a
->
Awaitable
r
toAwaitable
=
Awaitable
{-# MINIMAL toAwaitable | (runAwaitable, cacheAwaitable) #-}
data
Awaitable
r
=
forall
a
.
IsAwaitable
r
a
=>
Awaitable
a
data
Awaitable
r
=
forall
a
.
IsAwaitable
r
a
=>
Awaitable
a
instance
IsAwaitable
r
(
Awaitable
r
)
where
instance
IsAwaitable
r
(
Awaitable
r
)
where
...
...
This diff is collapsed.
Click to expand it.
src/Quasar/Disposable.hs
+
7
−
5
View file @
59bc7df0
...
@@ -8,19 +8,21 @@ module Quasar.Disposable (
...
@@ -8,19 +8,21 @@ module Quasar.Disposable (
noDisposable
,
noDisposable
,
alreadyDisposing
,
alreadyDisposing
,
-- * MonadResourceManager
MonadResourceManager
(
..
),
disposeEventually
,
withOnResourceManager
,
onResourceManager
,
-- ** ResourceManager
-- ** ResourceManager
ResourceManager
,
IsResourceManager
(
..
),
IsResourceManager
(
..
),
Monad
ResourceManager
(
..
)
,
ResourceManager
,
withResourceManager
,
withResourceManager
,
withOnResourceManager
,
newResourceManager
,
newResourceManager
,
unsafeNewResourceManager
,
unsafeNewResourceManager
,
onResourceManager
,
attachDisposable
,
attachDisposable
,
attachDisposeAction
,
attachDisposeAction
,
attachDisposeAction_
,
attachDisposeAction_
,
disposeEventually
,
-- * Task
-- * Task
Task
(
..
),
Task
(
..
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment