[Git][ghc/ghc][master] base: Add Generic instances to various datatypes under GHC.*

Marge Bot gitlab at gitlab.haskell.org
Thu May 21 16:10:53 UTC 2020



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


Commits:
55f0e783 by Fumiaki Kinoshita at 2020-05-21T12:10:44-04:00
base: Add Generic instances to various datatypes under GHC.*

* GHC.Fingerprint.Types: Fingerprint
* GHC.RTS.Flags: GiveGCStats, GCFlags, ConcFlags, DebugFlags, CCFlags, DoHeapProfile, ProfFlags, DoTrace, TraceFlags, TickyFlags, ParFlags and RTSFlags
* GHC.Stats: RTSStats and GCStats
* GHC.ByteOrder: ByteOrder
* GHC.Unicode: GeneralCategory
* GHC.Stack.Types: SrcLoc

Metric Increase:
    haddock.base

- - - - -


5 changed files:

- libraries/base/GHC/ByteOrder.hs
- libraries/base/GHC/Generics.hs
- libraries/base/GHC/RTS/Flags.hsc
- libraries/base/GHC/Stats.hsc
- libraries/base/changelog.md


Changes:

=====================================
libraries/base/GHC/ByteOrder.hs
=====================================
@@ -1,4 +1,5 @@
 {-# LANGUAGE CPP #-}
+{-# LANGUAGE DeriveGeneric #-}
 
 -----------------------------------------------------------------------------
 -- |
@@ -20,6 +21,8 @@ module GHC.ByteOrder where
 -- Required for WORDS_BIGENDIAN
 #include <ghcautoconf.h>
 
+import GHC.Generics (Generic)
+
 -- | Byte ordering.
 data ByteOrder
     = BigEndian    -- ^ most-significant-byte occurs in lowest address.
@@ -30,6 +33,7 @@ data ByteOrder
              , Enum    -- ^ @since 4.11.0.0
              , Read    -- ^ @since 4.11.0.0
              , Show    -- ^ @since 4.11.0.0
+             , Generic -- ^ @since 4.15.0.0
              )
 
 -- | The byte ordering of the target machine.


=====================================
libraries/base/GHC/Generics.hs
=====================================
@@ -746,6 +746,9 @@ import GHC.Classes ( Eq(..), Ord(..) )
 import GHC.Enum    ( Bounded, Enum )
 import GHC.Read    ( Read(..) )
 import GHC.Show    ( Show(..), showString )
+import GHC.Stack.Types ( SrcLoc(..) )
+import GHC.Unicode ( GeneralCategory(..) )
+import GHC.Fingerprint.Type ( Fingerprint(..) )
 
 -- Needed for metadata
 import Data.Proxy   ( Proxy(..) )
@@ -1477,6 +1480,14 @@ deriving instance Generic ((,,,,,,) a b c d e f g)
 -- | @since 4.12.0.0
 deriving instance Generic (Down a)
 
+-- | @since 4.15.0.0
+deriving instance Generic SrcLoc
+
+-- | @since 4.15.0.0
+deriving instance Generic GeneralCategory
+
+-- | @since 4.15.0.0
+deriving instance Generic Fingerprint
 
 -- | @since 4.6.0.0
 deriving instance Generic1 []


=====================================
libraries/base/GHC/RTS/Flags.hsc
=====================================
@@ -1,3 +1,4 @@
+{-# LANGUAGE DeriveGeneric #-}
 {-# LANGUAGE NoImplicitPrelude #-}
 {-# LANGUAGE RecordWildCards   #-}
 
@@ -47,6 +48,7 @@ import Foreign.C
 
 import GHC.Base
 import GHC.Enum
+import GHC.Generics (Generic)
 import GHC.IO
 import GHC.Real
 import GHC.Show
@@ -67,6 +69,7 @@ data GiveGCStats
     | SummaryGCStats
     | VerboseGCStats
     deriving ( Show -- ^ @since 4.8.0.0
+             , Generic -- ^ @since 4.15.0.0
              )
 
 -- | @since 4.8.0.0
@@ -117,6 +120,7 @@ data GCFlags = GCFlags
     , numa                  :: Bool
     , numaMask              :: Word
     } deriving ( Show -- ^ @since 4.8.0.0
+               , Generic -- ^ @since 4.15.0.0
                )
 
 -- | Parameters concerning context switching
@@ -126,6 +130,7 @@ data ConcFlags = ConcFlags
     { ctxtSwitchTime  :: RtsTime
     , ctxtSwitchTicks :: Int
     } deriving ( Show -- ^ @since 4.8.0.0
+               , Generic -- ^ @since 4.15.0.0
                )
 
 -- | Miscellaneous parameters
@@ -144,6 +149,7 @@ data MiscFlags = MiscFlags
     , linkerMemBase         :: Word
       -- ^ address to ask the OS for memory for the linker, 0 ==> off
     } deriving ( Show -- ^ @since 4.8.0.0
+               , Generic -- ^ @since 4.15.0.0
                )
 
 -- | Flags to control debugging output & extra checking in various
@@ -168,6 +174,7 @@ data DebugFlags = DebugFlags
     , hpc            :: Bool -- ^ @c@ coverage
     , sparks         :: Bool -- ^ @r@
     } deriving ( Show -- ^ @since 4.8.0.0
+               , Generic -- ^ @since 4.15.0.0
                )
 
 -- | Should the RTS produce a cost-center summary?
@@ -180,6 +187,7 @@ data DoCostCentres
     | CostCentresAll
     | CostCentresJSON
     deriving ( Show -- ^ @since 4.8.0.0
+             , Generic -- ^ @since 4.15.0.0
              )
 
 -- | @since 4.8.0.0
@@ -205,6 +213,7 @@ data CCFlags = CCFlags
     , profilerTicks :: Int
     , msecsPerTick  :: Int
     } deriving ( Show -- ^ @since 4.8.0.0
+               , Generic -- ^ @since 4.15.0.0
                )
 
 -- | What sort of heap profile are we collecting?
@@ -220,6 +229,7 @@ data DoHeapProfile
     | HeapByLDV
     | HeapByClosureType
     deriving ( Show -- ^ @since 4.8.0.0
+             , Generic -- ^ @since 4.15.0.0
              )
 
 -- | @since 4.8.0.0
@@ -262,6 +272,7 @@ data ProfFlags = ProfFlags
     , retainerSelector         :: Maybe String
     , bioSelector              :: Maybe String
     } deriving ( Show -- ^ @since 4.8.0.0
+               , Generic -- ^ @since 4.15.0.0
                )
 
 -- | Is event tracing enabled?
@@ -272,6 +283,7 @@ data DoTrace
     | TraceEventLog  -- ^ send tracing events to the event log
     | TraceStderr    -- ^ send tracing events to @stderr@
     deriving ( Show -- ^ @since 4.8.0.0
+             , Generic -- ^ @since 4.15.0.0
              )
 
 -- | @since 4.8.0.0
@@ -299,6 +311,7 @@ data TraceFlags = TraceFlags
     , sparksFull     :: Bool -- ^ trace spark events 100% accurately
     , user           :: Bool -- ^ trace user events (emitted from Haskell code)
     } deriving ( Show -- ^ @since 4.8.0.0
+               , Generic -- ^ @since 4.15.0.0
                )
 
 -- | Parameters pertaining to ticky-ticky profiler
@@ -308,6 +321,7 @@ data TickyFlags = TickyFlags
     { showTickyStats :: Bool
     , tickyFile      :: Maybe FilePath
     } deriving ( Show -- ^ @since 4.8.0.0
+               , Generic -- ^ @since 4.15.0.0
                )
 
 -- | Parameters pertaining to parallelism
@@ -326,6 +340,7 @@ data ParFlags = ParFlags
     , setAffinity :: Bool
     }
     deriving ( Show -- ^ @since 4.8.0.0
+             , Generic -- ^ @since 4.15.0.0
              )
 
 -- | Parameters of the runtime system
@@ -342,6 +357,7 @@ data RTSFlags = RTSFlags
     , tickyFlags      :: TickyFlags
     , parFlags        :: ParFlags
     } deriving ( Show -- ^ @since 4.8.0.0
+               , Generic -- ^ @since 4.15.0.0
                )
 
 foreign import ccall "&RtsFlags" rtsFlagsPtr :: Ptr RTSFlags


=====================================
libraries/base/GHC/Stats.hsc
=====================================
@@ -1,3 +1,4 @@
+{-# LANGUAGE DeriveGeneric #-}
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE NoImplicitPrelude #-}
 {-# LANGUAGE RecordWildCards #-}
@@ -24,6 +25,7 @@ import Control.Monad
 import Data.Int
 import Data.Word
 import GHC.Base
+import GHC.Generics (Generic)
 import GHC.Read ( Read )
 import GHC.Show ( Show )
 import GHC.IO.Exception
@@ -126,6 +128,7 @@ data RTSStats = RTSStats {
   , gc :: GCDetails
   } deriving ( Read -- ^ @since 4.10.0.0
              , Show -- ^ @since 4.10.0.0
+             , Generic -- ^ @since 4.15.0.0
              )
 
 --
@@ -174,6 +177,7 @@ data GCDetails = GCDetails {
   , gcdetails_nonmoving_gc_sync_elapsed_ns :: RtsTime
   } deriving ( Read -- ^ @since 4.10.0.0
              , Show -- ^ @since 4.10.0.0
+             , Generic -- ^ @since 4.15.0.0
              )
 
 -- | Time values from the RTS, using a fixed resolution of nanoseconds.


=====================================
libraries/base/changelog.md
=====================================
@@ -19,6 +19,10 @@
 
   * Add `singleton` function for `Data.List.NonEmpty`.
 
+  * Add `Generic` instances to `Fingerprint`, `GiveGCStats`, `GCFlags`,
+    `ConcFlags`, `DebugFlags`, `CCFlags`, `DoHeapProfile`, `ProfFlags`,
+    `DoTrace`, `TraceFlags`, `TickyFlags`, `ParFlags`, `RTSFlags`, `RTSStats`,
+    `GCStats`, `ByteOrder`, `GeneralCategory`, `SrcLoc`
 
 ## 4.14.0.0 *TBA*
   * Bundled with GHC 8.10.1



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/55f0e783d234af103cf4e1d51cd31c99961c5abe
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/20200521/c9a21c57/attachment-0001.html>


More information about the ghc-commits mailing list