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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:44:46+00:00 2026-05-22T23:44:46+00:00

I want to make my heap data structure. Also i want to make operations

  • 0

I want to make my heap data structure. Also i want to make operations with it in STM monad in multi-threaded application. The heap have size of 10 millions of elements. There are many operations on heap.

I have looked on this packages

  1. http://hackage.haskell.org/package/heap
  2. http://hackage.haskell.org/package/heaps

As i mean both of them are persistent. If we modify this data structure we get two versions.
It is memory ineffective for heap with big size.

As i guess i need to implement mutable heap.

I want to hear your opinion and advice to get what i want.

Thanks.

  • 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-22T23:44:47+00:00Added an answer on May 22, 2026 at 11:44 pm

    As Ankur points out, you may be outside the bounds of the pure functional side of Haskell. At least I have never seen a pure extract-min data structure with good memory performance — don’t take that to mean there isn’t one. Have you profiled the existing libraries to make sure that they are not adequate for your needs? (Remember that a persistent data structure does not mean that the entire data structure is copied whenever a mutation is made, there can be lots of sharing between different “versions”).

    However, Haskell also has an imperative side, and you could implement a heap on that side. The performance characteristics of imperative Haskell are close to those of any other imperative language, so you will probably want to base your heap off of a mutable array of some type.

    It might be tricky to implement it in a way that works nicely with STM, whose core concept is the TVar. You could base it off of a (even non-mutable) array of TVars, but since every operation touches the root of the heap there will be lots of contention and the STM overhead will hurt you. I would be more inclined to serialize access to the heap to one thread at a time using locks / MVars.

    I know Data.Vector.Mutable is a popular mutable array library. Others will be more informed than I in recommending a good mutable array library for your purposes.

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

Sidebar

Related Questions

I'd want to restrict the maximum heap size for a Java application but it
I want make interactive application where user launches it and can do various task
I have style sheet with a class name changebackgroundcolor i want make change in
I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same
I have uploaded a app in production mode to linode. I want make changes
I want to make in Haskell a mutable array based heap (the basic kind
I have a problem and I want to make sure if I am doing
I want make datetimepicker in my project. Using jquery how it is possible? I
I want make a bash script which returns the position of an element from
Let's say I want make some of my sources publicly available via my blog

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.