Here's the problem at hand: I have a file with some data like this:
Name;email;zip;status
Joe Doakes;[email protected];07123;A
Nancy Smith;[email protected];98146;I
Armando Gonzales;[email protected];77194;A
I want to semi-anonymize it by changing all the email addresses to end in @example.com and replacing the ZIP code with a random 5-digit number.
I'm OK with the part about opening the file in a do block and using hGetLine to get each line as a string, and passing it on to a function that will modify the email to @example.com and pass that back to the caller.
Where I’m confused is taking the result and passing it on to another function to replace the ZIP code with a random ZIP. Converting the number to a string isn’t the problem; it’s generating the random number. From what I’ve read, random numbers “live” in the IO monad, so I have to somehow wrap the string back up into IO, and, well, I am totally mystified at this point. I haven't even a good clue of a starting point.
Any advice/hints, please?
Thanks. I'm not sure what you mean by "quickcheck, since you are extracting the randomness" but I will read up on quickcheck.