So, I have something like:
[IO Blah, IO Blah, IO Blah]
and I really only need a list of Blah s, how can I do this?
Blah
PS: Yes, I work in the input / output function.
Use sequence .
sequence
Evaluate each action in a sequence from left to right and collect the results.
do blahs <- sequence listOfIoBlah -- now use blahs
You want sequence :: Monad m => [ma] -> m [a] . It works as you expect: all actions are performed in order, the results are collected and returned. Please note that nothing is returned if all commands are not completed.
sequence :: Monad m => [ma] -> m [a]
Hoogle can be very helpful in answering such questions if you know how to formulate the question as a type, for example: http://www.haskell.org/hoogle/?hoogle=%5BIO+a%5D+-%3E+IO+% 5Ba% 5D
Source: https://habr.com/ru/post/911457/More articles:How to expand a table using T-SQL? - tsqlHow to increase the space between edges (splines) and nodes in the graph? - graphvizTrap Creating a Handle in WOW64 - windowsUnsafe JavaScript trying to access frame ... Domains, protocols and ports must match - javascriptUse rails_xss only on certain pages - ruby ββ| fooobar.comThe best way to add a filter to a URL in .NET MVC is filterChoosing from a subquery in DQL - symfonyHow to set up an updated view with Firebird attachment? - sqlHow to create an Android application to control Arduino via Wi-Fi? - androidtrying to create phantom in MySQL under isolation level REPEATABLE-READ - javaAll Articles