Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9116407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:39:55+00:00 2026-06-17T04:39:55+00:00

I have a long-running computation that outputs a list. I want to output values

  • 0

I have a long-running computation that outputs a list. I want to output values from this list as they are computed. What would be a neat way to do this?

Currently I use mapM_ print to print each value to STDOUT. This works well enough for the simple case of printing values to the command line, but feels a little bit hacky and hard to work with.

Additionally, at some point, I want to turn my command-line output into an interactive visualization. How could I go about turning my list into something like a stream of events from FRP? Being able to plug this into an existing GUI framework as a source of events would be great.

Rewriting the function to use something other than a list is an option, although a solution that allows me to take the list as-is would be ideal.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:39:57+00:00Added an answer on June 17, 2026 at 4:39 am

    This is a job for iteratees and iteratees like libraries.

    Using the Proxy library.

    import Control.Proxy
    
    runProxy $ fromListS [1..10] >-> <processing> >-> printD >-> <more> processing>
    

    Where <processing> is the addition calculations you need to make.

    Similar questions: lazy version of mapM, Is Haskell’s mapM not lazy?

    For example:

    > labeledPrint label x = putStrLn $ label ++ show x
    > runProxy $ fromListS [1..4] >-> printD >-> mapD (*2) 
                                  >-> useD (labeledPrint "Second printer: ")
    1
    Second printer: 2
    2
    Second printer: 4
    3
    Second printer: 6
    4
    Second printer: 8
    

    If you reverse the order of application and use <-< instead of >-> then it looks like normal function application.

    runProxy $ useD (labeledPrint "Second printer: ") <-< mapD (*2)
                                                      <-< printD
                                                      <-< fromListS [1..4]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long running program, my_prog that has some output that I want
I have a long running PHP script that i want to be executed in
I have some long running tasks (IE retrieving complex data from a DB) that
I have a long running PHP process, that sometimes hangs in a loop. This
I have a long running task that benefits from multithreading. A L2S entity is
I have a long running process in VB6 that I want to finish before
I have several long running report type transactions that take 5-10 minutes. Would I
I have a long running process that is called via a Nancy Module Get
I have a long running console app running through millions of iterations. I want
I have a long-running cleanup operation that I need to perform in onDestroy() of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.