Commit 55f0e783 authored by Fumiaki Kinoshita's avatar Fumiaki Kinoshita 💬 Committed by Marge Bot

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
parent 5bcf8606
Pipeline #19594 failed with stages
in 619 minutes and 51 seconds
{-# 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.
......
......@@ -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 []
......
{-# 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
......
{-# 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.
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment