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

  • SEARCH
  • Home
  • 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 7019223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:09:19+00:00 2026-05-27T23:09:19+00:00

Apparently it is possible to implement Haskell such that it evaluates eagerly without changing

  • 0

Apparently it is possible to implement Haskell such that it evaluates eagerly without changing the semantics of the language at all. If that is true, how are infinite data structures handled?

http://csg.csail.mit.edu/pubs/haskell.html

Therefore, a great deal of time is spent creating and destroying suspended pieces of computation (thunks). All too often, these computations are simple enough that it would be just as easy to evaluate them instead. Faxen and others have used static analysis to expose such opportunities for eagerness. We instead propose using eagerness everywhere, while using mechanisms which permit us to recover if our program is too eager.

The key thing there being “we have mechanisms to recover if our program is too eager”. What are these mechanism? How do they permit for infinite data structures and the other aspects of lazy evaluation that I’ve been led to believe are impossible in an eager language?

  • 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-05-27T23:09:19+00:00Added an answer on May 27, 2026 at 11:09 pm

    That’s not quite true: you can evaluate Haskell terms eagerly if you can prove that they won’t diverge.

    For instance, when you see f x, you could first execute up to 1,000 steps of x (stopping if you reach WHNF (weak head normal form) or an error), and then pass it to f — the semantics are preserved, but if you think x is going to be evaluated, then you can arrange for this to happen ahead of time as an optimisation.

    If x = fix id, it’ll just give up after 1,000 steps of not going anywhere. If x = undefined, it’ll cause an error and give up (restoring the original thunk and passing it to f). And so on.

    If x = [1..], then it might end up reducing it to 1 : 2 : 3 : ... : 999 : 1000 : [1001..], reach the limit, and stop there, passing the result to f.

    Basically: By either proving that an expression cannot diverge, or bounding the evaluation so that things terminate even if it does. No change to the semantics, and possibly a big improvement to performance.

    Of course, the downside is that if x turns out to be some really expensive computation that f only uses half of, you’ll spend 1,000 reduction steps wasting time. And in the case of [1..], you could end up using a lot of memory to store a list; if f processes the list one element at a time, throwing away the head each time, then you’ll waste memory. That’s why it’s tricky 🙂

    The page you originally linked goes into more detail as to the specific techniques used.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to implement McCarthy's amb -operator for non-deterministic choice in C#? Apparently
Apparently, they're confusing. Is that seriously the reason? Can you think of any others?
Apparently I can't move files on different volumes using Directory.Move. I have read that
Apparently some vendors (like Telerik) are working on versions of their controls that do
Possible Duplicate: What is the difference between += and =+? Apparently =+ is a
It's apparently possible to get a lot of info relating to attached disks using
so apparently it's possible to compile PHP do decouple it from the interpreter: http://en.wikipedia.org/wiki/Php#Compilers
Possible Duplicate: Timer Won't Fire Correctly Apparently, in Java 1.6, the Timer doesn't work
Im trying to implement multi-language support in my system, the other systems at work
Apparently it is possible to dynamically attach DataAnnotation attributes to object properties at runtime

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.