Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,390
    • Issues 4,390
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 373
    • Merge Requests 373
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #2359

Closed
Open
Opened Jun 14, 2008 by nwf@trac-nwf

Data.IntMap update{Min,Max}WithKey corrupts data structure

Updates on the supposedly minimum element aren't:

GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
Prelude> import Data.IntMap
Prelude Data.IntMap> let base = (insert 2 "b" (singleton 1 "a"))
Loading package array-0.1.0.0 ... linking ... done.
Loading package containers-0.1.0.1 ... linking ... done.
Prelude Data.IntMap> let umin = updateMinWithKey (\ k _ -> ("yo!" ++ (show k)) ) base
Prelude Data.IntMap> umin
fromList [(1,"a"),(2,"yo!2")]
Prelude Data.IntMap> showTree umin
"*\n+-- 1:=\"a\"\n+-- 2:=\"yo!2\"\n"

Updates on the maximum element are even worse, corrupting the data structure (ghci session continued):

Prelude Data.IntMap> let umax = updateMaxWithKey (\ k _ -> ("yo!" ++ (show k)) ) base
Prelude Data.IntMap> umax
fromList [(1,"yo!1"),(1,"a")]
Prelude Data.IntMap> showTree umax
"*\n+-- 1:=\"yo!1\"\n+-- 1:=\"a\"\n"

GHC is Debian 6.8.2-5.

Anything else that would be helpful? Thanks much in advance.

Trac metadata
Trac field Value
Version 6.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
6.10.1
Milestone
6.10.1
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#2359