Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: d751a9f1 by Pierre Thierry at 2025-07-21T13:37:28-04:00 Fix documentation about deriving from generics - - - - - 1 changed file: - libraries/base/src/GHC/Generics.hs Changes: ===================================== libraries/base/src/GHC/Generics.hs ===================================== @@ -392,9 +392,14 @@ module GHC.Generics ( -- instance (Encode a) => Encode (Tree a) -- @ -- --- The generic default is being used. In the future, it will hopefully be --- possible to use @deriving Encode@ as well, but GHC does not yet support --- that syntax for this situation. +-- The generic default is being used. Alternatively the @DeriveAnyClass@ language extension can be +-- used to derive Encode: +-- +-- @ +-- {-# LANGUAGE DeriveAnyClass #-} +-- data Tree a = Leaf a | Node (Tree a) (Tree a) +-- deriving (Generic, Encode) +-- @ -- -- Having @Encode@ as a class has the advantage that we can define -- non-generic special cases, which is particularly useful for abstract View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d751a9f1b45d65f38805b9d103af707e... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d751a9f1b45d65f38805b9d103af707e... You're receiving this email because of your account on gitlab.haskell.org.