Cross-post from Slack:
Hi, I am looking for a function with the signature Array (Effect Unit) -> Effect Unit
where all of the effects are executed. I know that I have used something similar in Haskell before, but I have not been able to find it. Help is greatly appreciated!
Answer:
When you’re looking for a function like that you can use typed holes:
main :: Effect Unit
main = do
let (effects :: Array (Effect Unit)) = map Console.log ["Hello", "Friend"]
?x effects
You may also search for the signature on pursuit:
https://pursuit.purescript.org/search?q=Array+(Effect+Unit)+->+Effect+Unit
In this case, you’re looking for sequence_
Btw, if you get that Array (Effect Unit)
from mapping over an array, you can do the mapping + sequence in one go using traverse_