haskell / haskell/deepseq

Add method to help with strict containers

Open
#97 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
45
Forks
31
PR merge metrics
No merged PRs in 30d

Description

I propose an `NFData` method (by some name)

```haskell
whnfIsNf :: proxy a -> Bool
whnfIsNf _ = False
```

Then we can have, for example,

```haskell
instance NFData Integer where
whnfIsNf _ = True
instance NFData a => NFData (Set a) where
whnfIsNf _ = whnfIsNf (Proxy :: Proxy a)
rnf
| whnfIsNf (Proxy :: Proxy a)
= \ !_ -> ()
| otherwise
= ....
```

This can avoid a bunch of unnecessary traversals.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the NFData interface and the proposed Set instance, then examine how strict containers are currently traversed. The issue names no files or tests; done would require settling the method name and semantics, adding the relevant NFData support, and demonstrating that unnecessary traversals are avoided.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
performance
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.