haskell / haskell/deepseq

Add instances for GHC.Generics data types

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

Description

I'm currently in a situation where I want to `rnf` a value from an upstream library, but it doesn't define `NFData` instances.

It does, however, define a `Generic` instance. If there were `NFData` instances for the data types defined in `GHC.Generics` (eg `U1` etc), I could write `rnf . GHC.Generics.from`. Alternatively, if `deepseq` exported its `grnf` definition, I could similarly write `grnf . GHC.Generics.from`.

Either of those would let me avoid something like an orphan instance etc. (Those can be harmless eg in exes or tests, but I try to avoid them in general.)

Are there pitfalls that would make exporting these instances/`grnf` a footgun for users, or would this merely provide users more options? Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the deepseq API around NFData and grnf, then inspect the GHC.Generics types mentioned in the issue, including U1. Determine whether adding NFData instances or exporting grnf is safe and unambiguous; done means the maintainers have a decided approach and corresponding documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.