-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation improvements #104
Comments
The unary/binary polymorphism is not the same kind as you are thinking. I believe |
Yes, I'm aware that From my point of view, the most important questions about
|
The only part of the interface that need concern the day-to-day developer are the "Helper functions". These are normally what you want for making sure your own data is in RNF at certain evaluation steps. For example, |
Right, and isn't the "Generic NFData deriving" section also aimed at the day-to-day developer, whose goal is to apply the "Helper functions" to their own data types? If so, wouldn't it be less confusing to remove the derived |
The "Generic NFData deriving" documentation section shows how to derive instances of both
NFData
andNFData1
forFoo
, but it doesn't say anything about when generic instances needNFData1
(theNFData1
documentation doesn't help either). As this is in theNFData
class documentation, for people like me who first encounteredNFData
through a package that depends on it (Criterion in my case), this gives the impression that there must be a mysterious technicality that requires you to deriveNFData1
for types with a single type parameter whenever you need anNFData
instance. This is what I thought until I experimented and found thatdeepseq
works fine on yourFoo
example without theNFData1
instance. E.g. in GHCi 8.10.7:I see from the source code that
rnf = rnf1
for functors like list,Maybe
andEither
, so I now wonder ifNFData1
andNFData2
are just helper classes that are only useful when you're manually derivingNFData
instances. Are there cases whereNFData
cannot be generically derived for unary/binary polymorphic types withoutNFData1/2
? If not, can the derivation ofNFData1
be removed from theFoo
examples, and can a note be added stating that generic instances do not requireNFData1/2
? Or ifNFData1/2
does need to be generically derived sometimes, can someone add an explanation to the documentation?The text was updated successfully, but these errors were encountered: