From e1fb56b24e2fe45a6f628f651bfc12b2b9743378 Mon Sep 17 00:00:00 2001 From: David Feuer Date: Sat, 25 Mar 2023 17:56:47 -0400 Subject: Document the constructor name for lists Derived `Data` instances use raw infix constructor names when applicable. The `Data.Data [a]` instance, if derived, would have a constructor name of `":"`. However, it actually uses constructor name `"(:)"`. Document this peculiarity. See https://github.com/haskell/core-libraries-committee/issues/147 --- libraries/base/Data/Data.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libraries/base') diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs index 5fcecc867a..c0a4495e14 100644 --- a/libraries/base/Data/Data.hs +++ b/libraries/base/Data/Data.hs @@ -1136,7 +1136,10 @@ consConstr = mkConstr listDataType "(:)" [] Infix listDataType :: DataType listDataType = mkDataType "Prelude.[]" [nilConstr,consConstr] --- | @since 4.0.0.0 +-- | For historical reasons, the constructor name used for @(:)@ is +-- @"(:)"@. In a derived instance, it would be @":"@. +-- +-- @since 4.0.0.0 instance Data a => Data [a] where gfoldl _ z [] = z [] gfoldl f z (x:xs) = z (:) `f` x `f` xs -- cgit v1.2.1