[Haskell-cafe] Random question
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Wed Sep 24 19:21:17 EDT 2008
On 2008 Sep 24, at 17:44, Iain Barnett wrote:
> On 24 Sep 2008, at 10:13 pm, Evan Laforge wrote:
>> For one approach, check
>> out 'replicate' to make copies of something, and then 'sequence' to
>> run them and return a list.
> Thanks, I haven't found anything that explains 'sequence' well yet,
> but I'll keep looking.
sequence turns a list of monadic values into a monadic list of values,
i.e. [m a] becomes m [a]. In IO, this is [IO a] -> IO [a]. This lets
you do something like replicate an I/O action, then turn the list of I/
O actions into a single I/O action on a list.
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe