diff options
author | David Feuer <David.Feuer@gmail.com> | 2023-03-25 17:56:47 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-03-26 15:33:41 -0400 |
commit | e1fb56b24e2fe45a6f628f651bfc12b2b9743378 (patch) | |
tree | 1a3a9aebf983bc432aeb6843a14518953803112b /libraries | |
parent | 4f93de888fb8be5241b476442045eb40b2a5abbd (diff) | |
download | haskell-e1fb56b24e2fe45a6f628f651bfc12b2b9743378.tar.gz |
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
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/Data/Data.hs | 5 |
1 files changed, 4 insertions, 1 deletions
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 |