CS代考 ECS713U/P Functional Programming 2021/22 – cscodehelp代写
ECS713U/P Functional Programming 2021/22
Task: During this individual project you will implement a Haskell stack app that uses threads and concurrent computation. Your task to simulate a social network. The main program
should spawn ten “user” threads, and each of these threads model a user in the social network. The customers should then (at random intervals) choose one of the other users (at
random) and send a random message to that user.
1. Your project should define an appropriate Haskell data type User, which should include their username, and a Message type to keep track of messages between users.
2. Your project should also contain a main thread which creates ten “users” (ten values of type User), and spawns ten threads, one for each of these users.
3. Each user thread should behave as follows: at random time intervals, the thread should select one of the other users at random, and send a random message to that user.
4. Your system should simulate 100 messages, and then terminate and output the final count of how many messages each user received.
5. Make sure each definition includes haddock style comments.
6. You should also write a one-page report, detailing any issues you have faced, and justifying any design decisions you’ve had to make (e.g. how you chose to model the User and
Message types, and how did you choose which MVars to use).
For the top 20% of the mark you must come up with some extension of the given basic specification above. Try to be creative and unique, and describe your extension in the report
(one paragraph should be enough).