This line in the go
function:
go $ map draw $ maybeAddToQueue prng (x:xs)
doesn't actually execute any of the IO actions - it just creates new IO actions from existing ones.
Here are some type signatures of how I would approach the problem:
type World = [Raindrop]
-- draw the raindrops
draw :: World -> IO ()
-- advance the drops
step :: World -> World
-- add more drops
moreRain :: World -> IO (World)
-- the main loop
loop :: World -> IO ()
loop drops = do
draw drops
let drops' = step drops
drops'' <- moreRain drops'
-- delay for a while here???
loop drops''
Notes:
- I've declared
step
to be a pure function on the assumption that motion of the drops is deterministic moreRain
however needs to use a random number generator, so it is an IO action