haskell / haskell/containers

`-> Solo a` functions for lazy maps

Open
#1,132 0 comments 0 reactions 0 assignees View on GitHub
feature-request IntMap Map
Dominant language
Haskell
Stars
355
Forks
194
Avg merge
3d 4h
Merged PRs (30d)
4

Description

I don't know if it comes up in practice, but for lazy maps we can have functions like

```hs
insertWith :: Ord k => (a -> a -> Solo a) -> k -> a -> Map k a -> Map k a
unionWith :: Ord k => (a -> a -> Solo a) -> Map k a -> Map k a -> Map k a
...
```

This gives the caller precise control over _which thunk_ to put in the map.
Right now, with `(a -> a -> a)` versions, it's always going to be the function application (unless the map operation inlines and simplifies).

I'm not planning to add these right away, but if someone wants them it makes a lot of sense to add them.

Contributor guide

Open the contributing guide

Research direction

Start by locating the lazy-map APIs and comparing the existing insertWith and unionWith signatures with the proposed Solo-based forms in the issue. Determine the complete set of related functions to cover and define done as a consistent API addition with appropriate tests for thunk selection and behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.