Generic 'NFData' instance breaks with embedded function space (regression in GHC 9.10.3)
- Dominant language
- Haskell
- Stars
- 45
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
Deriving `NFData` from `Generic` does not work any longer if a constructor embeds function spaces.
https://github.com/agda/agda/blob/9fa8910e340cf5b860f96b817516914f87054364/src/full/Agda/Utils/Benchmark.hs#L47-L48 https://github.com/agda/agda/blob/9fa8910e340cf5b860f96b817516914f87054364/src/full/Agda/Utils/Benchmark.hs#L247
```haskell
data BenchmarkOn a = BenchmarkOff | BenchmarkOn | BenchmarkSome (Account a -> Bool)
deriving Generic
instance NFData a => NFData (BenchmarkOn a)
```
```
src/full/Agda/Utils/Benchmark.hs:247:10: error: [GHC-68441] [-Wdeprecations, -Werror=deprecations]
In the use of
instance NFData (a -> b) -- Defined in ‘Control.DeepSeq’
arising from a use of ‘Control.DeepSeq.$dmrnf’
Deprecated: "NFData is not well-defined on function types. https://github.com/haskell/deepseq/issues/16"
|
247 | instance NFData a => NFData (BenchmarkOn a)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
Could you export instead an ` instance NFData (a -> b)` that does nothing?
What would one anyway expect from normalizing a function? It is the same function again, because we cannot look into the black box.
I think keeping ` instance NFData (a -> b)` would be a better migration path, in the light that most of `NFData` instances are probably derived generically.
Ref:
- #16
- #109 (@L0neGamer @mixphix)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.