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
76037b6d
Commit
76037b6d
authored
2 years ago
by
Jens Nolte
Browse files
Options
Downloads
Patches
Plain Diff
Generate wrappers for orElse and catchSTM
Co-authored-by:
Jan Beinke
<
git@janbeinke.com
>
parent
a642471c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stm-ltd/src/Control/Concurrent/STM/Class.hs
+5
-16
5 additions, 16 deletions
stm-ltd/src/Control/Concurrent/STM/Class.hs
with
5 additions
and
16 deletions
stm-ltd/src/Control/Concurrent/STM/Class.hs
+
5
−
16
View file @
76037b6d
...
...
@@ -249,20 +249,10 @@ unsafeLimitSTM fn = liftSTM' (STM' fn)
{-# INLINABLE unsafeLimitSTM #-}
-- Documentation is copied via template-haskell
orElse
::
MonadSTM
m
=>
STM
a
->
STM
a
->
m
a
orElse
fx
fy
=
liftSTM
(
STM
.
orElse
fx
fy
)
{-# INLINABLE orElse #-}
orElse'
::
MonadSTM'
r
t
m
=>
STM'
CanRetry
t
a
->
STM'
r
t
a
->
m
a
orElse'
fx
fy
=
unsafeLimitSTM
$
STM
.
orElse
(
runSTM'
fx
)
(
runSTM'
fy
)
{-# INLINABLE orElse' #-}
-- Documentation is copied via template-haskell
catchSTM
::
(
MonadSTM
m
,
Exception
e
)
=>
STM
a
->
(
e
->
STM
a
)
->
m
a
catchSTM
fx
fn
=
liftSTM
(
STM
.
catchSTM
fx
fn
)
{-# INLINABLE catchSTM #-}
catchSTM'
::
(
MonadSTM'
r
CanThrow
m
,
Exception
e
)
=>
STM'
r
CanThrow
a
->
(
e
->
STM'
r
CanThrow
a
)
->
m
a
catchSTM'
fx
fn
=
unsafeLimitSTM
$
STM
.
catchSTM
(
runSTM'
fx
)
\
ex
->
runSTM'
(
fn
ex
)
{-# INLINABLE catchSTM' #-}
...
...
@@ -284,12 +274,6 @@ $(mconcat <$> (execWriterT do
r
<-
lift
$
varT
<$>
newName
"r"
t
<-
lift
$
varT
<$>
newName
"t"
-- Manually implemented wrappers
lift
$
mapM_
(
uncurry
copyDoc
)
[
(
'orElse
,
'STM
.
orElse
),
(
'catchSTM
,
'STM
.
catchSTM
)
]
tellQs
$
mapM
(
mkMonadClassWrapper
[
t
|
MonadSTM' CanRetry $t
|]
[
|
unsafeLimitSTM
|
])
[
'STM
.
retry
,
'STM
.
check
...
...
@@ -299,6 +283,11 @@ $(mconcat <$> (execWriterT do
'STM
.
throwSTM
]
tellQs
$
mapM
(
mkMonadClassWrapper
[
t
|
MonadSTM
|]
[
|
liftSTM
|
])
[
'STM
.
orElse
,
'STM
.
catchSTM
]
tellQs
$
mapM
mkMonadIOWrapper
[
'STM
.
atomically
]
...
...
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