Tracks
/
Haskell
Haskell
/
Exercises
/
Parallel Letter Frequency
Parallel Letter Frequency

Parallel Letter Frequency

Medium

Instructions

Count the frequency of letters in texts using parallel computation.

Parallelism is about doing things in parallel that can also be done sequentially. A common example is counting the frequency of letters. Create a function that returns the total frequency of each letter in a list of texts and that employs parallelism.

Your code should contain a frequency :: Int -> [Text] -> Map Char Int function which accepts a number of workers to use in parallel and a list of texts and returns the total frequency of each letter in the text.

Benchmark

Check how changing number of workers affects performance of your solution by running the benchmark. Use stack bench to run it. Feel free to modify bench/Benchmark.hs to explore your solution's performance on different inputs.

Edit via GitHub The link opens in a new window or tab
Haskell Exercism

Ready to start Parallel Letter Frequency?

Sign up to Exercism to learn and master Haskell with 107 exercises, and real human mentoring, all for free.

Deep Dive into Parallel Letter Frequency!

We explore the differences between concurrency and parallelism, looking at different approaches taken by languages such as JavaScript, Go, Elixir and Rust.