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 7827801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:03:22+00:00 2026-06-02T10:03:22+00:00

I was writing some code and I figured that I’d be able to create

  • 0

I was writing some code and I figured that I’d be able to create an infinite map from an infinite list of tuples. Something along the lines of the following:
Map.fromList [(i,i+1)|i<-[1..]]

Of course, I discovered immediately that Data.Map and Data.Set do not support infinite Maps and Sets respectively. I noticed a similar question about Data.Set’s greedy implementation of fromList, and, after reading over the answers here, it’s clear that both lazy and greedy implementations are possible for Set, just that the greedy ones work better. I don’t really understand, however, why a lazy implementation of Map.fromList wouldn’t work. Something to do with how keys are stored?

  • 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-02T10:03:25+00:00Added an answer on June 2, 2026 at 10:03 am

    Data.Map is implemented as a balanced tree (roughly binary, I think); it’s hard to create and balance infinite binary trees lazily without some foreknowledge about the input! However, you might like something like the MemoTrie package, which uses lazy infinite tries (of bits) instead.

    > let x = trie (\x -> x+1)
    > untrie x 72
    73
    > untrie x 37
    38
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing some code that has a lot of substitution. There's a list<char> productions
I'm writing some code (just for fun so far) in Python that will store
I am writing some code that connects to a website, and using C#, and
i am writing some code in vb.net that will be generating a pdf file.
I am writing some code that needs to be backwards compatible with EXISTING remoting
I'm writing some code that looks like this: while(true) { switch(msg->state) { case MSGTYPE:
I am writing some code in which i need to get a line from
Im running into this error that I can't work out Im writing some code
I am writing a calendar-based web application and am working on some code that
I've recently been writing some code for a research project that I'm working on,

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.