Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
3a1efe1a
Commit
3a1efe1a
authored
Aug 11, 2019
by
Richard Lupton
Committed by
Marge Bot
Aug 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-export foldlM and foldrM from Data.Foldable in MonadUtils (#16969)
parent
ac7c738b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
9 deletions
+1
-9
compiler/utils/MonadUtils.hs
compiler/utils/MonadUtils.hs
+1
-9
No files found.
compiler/utils/MonadUtils.hs
View file @
3a1efe1a
...
...
@@ -32,7 +32,7 @@ import Control.Applicative
import
Control.Monad
import
Control.Monad.Fix
import
Control.Monad.IO.Class
import
Data.Foldable
(
sequenceA_
,
fold
r
)
import
Data.Foldable
(
sequenceA_
,
fold
lM
,
foldrM
)
import
Data.List
(
unzip4
,
unzip5
,
zipWith4
)
-------------------------------------------------------------------------------
...
...
@@ -190,18 +190,10 @@ allM f (b:bs) = (f b) >>= (\bv -> if bv then allM f bs else return False)
orM
::
Monad
m
=>
m
Bool
->
m
Bool
->
m
Bool
orM
m1
m2
=
m1
>>=
\
x
->
if
x
then
return
True
else
m2
-- | Monadic version of foldl
foldlM
::
(
Monad
m
,
Foldable
t
)
=>
(
a
->
b
->
m
a
)
->
a
->
t
b
->
m
a
foldlM
=
foldM
-- | Monadic version of foldl that discards its result
foldlM_
::
(
Monad
m
,
Foldable
t
)
=>
(
a
->
b
->
m
a
)
->
a
->
t
b
->
m
()
foldlM_
=
foldM_
-- | Monadic version of foldr
foldrM
::
(
Monad
m
,
Foldable
t
)
=>
(
b
->
a
->
m
a
)
->
a
->
t
b
->
m
a
foldrM
k
z
x
=
foldr
(
\
x
r
->
r
>>=
k
x
)
(
pure
z
)
x
-- | Monadic version of fmap specialised for Maybe
maybeMapM
::
Monad
m
=>
(
a
->
m
b
)
->
(
Maybe
a
->
m
(
Maybe
b
))
maybeMapM
_
Nothing
=
return
Nothing
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment