Skip to content

Add parFmap function#53

Merged
simonmar merged 1 commit intohaskell:masterfrom
Boarders:generalise-parmap
Jul 22, 2019
Merged

Add parFmap function#53
simonmar merged 1 commit intohaskell:masterfrom
Boarders:generalise-parmap

Conversation

@Boarders
Copy link
Contributor

Control.Parallel.Strategies defines:

parMap :: Strategy b -> (a -> b) -> [a] -> [b]
parMap strat f = (`using` parList strat) . map f

However parList is defined in terms of parTraversable:

parList :: Strategy a -> Strategy [a]
parList = parTraversable

This pull request generalises parMap to:

parFmap :: Traversable t => Strategy b -> (a -> b) -> t b -> t b
parFmap strat g = (`using` parTraversable strat) . fmap f

The old definition is still left in place.

@simonmar simonmar merged commit 2e1e6ac into haskell:master Jul 22, 2019
@konsumlamm konsumlamm mentioned this pull request May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants