[Git][ghc/ghc][master] Document the constructor name for lists

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sun Mar 26 19:33:56 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
e1fb56b2 by David Feuer at 2023-03-26T15:33:41-04:00
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

- - - - -


1 changed file:

- libraries/base/Data/Data.hs


Changes:

=====================================
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



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e1fb56b24e2fe45a6f628f651bfc12b2b9743378

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e1fb56b24e2fe45a6f628f651bfc12b2b9743378
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230326/a8d22a74/attachment.html>


More information about the ghc-commits mailing list