<commit_before>module Control.Parallel
  ( parApply
  , parTraverse
  , parTraverse_
  , parSequence
  , parSequence_
  , parOneOf
  , parOneOfMap
  , module Control.Parallel.Class
  ) where

import Prelude

import Control.Alternative (class Alternative)
import Control.Parallel.Class (class Parallel, parallel, sequential, ParCont(..))

import Data.Foldable (class Foldable, traverse_, oneOfMap)
import Data.Traversable (class Traversable, traverse)

-- | Apply a function to an arguement under a type constructor in parallel.
parApply
  :: forall f m a b
   . Parallel f m
   => m (a -> b)
   -> m a
   -> m b
parApply mf ma = sequential(apply (parallel mf) (parallel ma))

-- | Traverse a collection in parallel.
parTraverse
  :: forall f m t a b
   . Parallel f m
  => Traversable t
  => (a -> m b)
  -> t a
  -> m (t b)
parTraverse f = sequential <<< traverse (parallel <<< f)

-- | Traverse a collection in parallel, discarding any results.<commit_msg>Fix typo: arguement → argument<commit_after>module Control.Parallel
  ( parApply
  , parTraverse
  , parTraverse_
  , parSequence
  , parSequence_
  , parOneOf
  , parOneOfMap
  , module Control.Parallel.Class
  ) where

import Prelude

import Control.Alternative (class Alternative)
import Control.Parallel.Class (class Parallel, parallel, sequential, ParCont(..))

import Data.Foldable (class Foldable, traverse_, oneOfMap)
import Data.Traversable (class Traversable, traverse)

-- | Apply a function to an argument under a type constructor in parallel.
parApply
  :: forall f m a b
   . Parallel f m
   => m (a -> b)
   -> m a
   -> m b
parApply mf ma = sequential(apply (parallel mf) (parallel ma))

-- | Traverse a collection in parallel.
parTraverse
  :: forall f m t a b
   . Parallel f m
  => Traversable t
  => (a -> m b)
  -> t a
  -> m (t b)
parTraverse f = sequential <<< traverse (parallel <<< f)

-- | Traverse a collection in parallel, discarding any results.
{'fraction_non_alphanumeric': 0.10144927536231885, 'fraction_numerical': 0.0, 'mean_word_length': 3.343820224719101, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2101256', 'n_tokens_mistral': 640, 'n_tokens_neox': 625, 'n_words': 225}