Commit 47b5b5c2 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺
Browse files

base: drop redundant Typeable derivings

Thanks to #9858 `Typeable` doesn't need to be explicitly derived anymore.
This also makes `AutoDeriveTypeable` redundant, as well as some imports of
`Typeable` (removal of whose may be beneficial to #9707). This commit
removes several such now redundant use-sites in `base`.

Reviewed By: austin, ekmett

Differential Revision: https://phabricator.haskell.org/D712
parent 68d4f472
......@@ -2,7 +2,6 @@
{-# LANGUAGE NoImplicitPrelude
, ExistentialQuantification
, MagicHash
, DeriveDataTypeable
#-}
{-# OPTIONS_HADDOCK hide #-}
......@@ -40,7 +39,6 @@ When an exception of type @e@ is thrown, behind the scenes it is
encapsulated in a @SomeException@.
-}
data SomeException = forall e . Exception e => SomeException e
deriving Typeable
instance Show SomeException where
showsPrec p (SomeException e) = showsPrec p e
......@@ -161,7 +159,7 @@ throw e = raise# (toException e)
-- |This is thrown when the user calls 'error'. The @String@ is the
-- argument given to 'error'.
newtype ErrorCall = ErrorCall String
deriving (Eq, Ord, Typeable)
deriving (Eq, Ord)
instance Exception ErrorCall
......@@ -179,7 +177,7 @@ data ArithException
| DivideByZero
| Denormal
| RatioZeroDenominator -- ^ @since 4.6.0.0
deriving (Eq, Ord, Typeable)
deriving (Eq, Ord)
divZeroException, overflowException, ratioZeroDenomException :: SomeException
divZeroException = toException DivideByZero
......
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE MagicHash, UnboxedTuples, AutoDeriveTypeable, TypeFamilies,
{-# LANGUAGE MagicHash, UnboxedTuples, TypeFamilies, DeriveDataTypeable,
MultiParamTypeClasses, FlexibleInstances, NoImplicitPrelude #-}
-----------------------------------------------------------------------------
......@@ -140,7 +140,7 @@ traceEvent = Debug.Trace.traceEventIO
-- entire ghc package at runtime
data SpecConstrAnnotation = NoSpecConstr | ForceSpecConstr
deriving( Data, Typeable, Eq )
deriving( Data, Eq )
{- **********************************************************************
......
......@@ -5,7 +5,7 @@
, UnboxedTuples
#-}
{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE AutoDeriveTypeable, StandaloneDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
-----------------------------------------------------------------------------
-- |
......@@ -46,7 +46,6 @@ module GHC.ForeignPtr
import Foreign.Storable
import Data.Foldable ( sequence_ )
import Data.Typeable
import GHC.Show
import GHC.Base
......@@ -71,7 +70,6 @@ import GHC.Ptr ( Ptr(..), FunPtr(..) )
-- class 'Storable'.
--
data ForeignPtr a = ForeignPtr Addr# ForeignPtrContents
deriving Typeable
-- we cache the Addr# in the ForeignPtr object, but attach
-- the finalizer to the IORef (or the MutableByteArray# in
-- the case of a MallocPtr). The aim of the representation
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, AutoDeriveTypeable, MagicHash,
{-# LANGUAGE NoImplicitPrelude, MagicHash,
ExistentialQuantification #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
{-# OPTIONS_HADDOCK hide #-}
......@@ -52,7 +52,7 @@ import GHC.Exception
import GHC.IO.Handle.Types
import Foreign.C.Types
import Data.Typeable ( Typeable, cast )
import Data.Typeable ( cast )
-- ------------------------------------------------------------------------
-- Exception datatypes and operations
......@@ -60,7 +60,6 @@ import Data.Typeable ( Typeable, cast )
-- |The thread is blocked on an @MVar@, but there are no other references
-- to the @MVar@ so it can't ever continue.
data BlockedIndefinitelyOnMVar = BlockedIndefinitelyOnMVar
deriving Typeable
instance Exception BlockedIndefinitelyOnMVar
......@@ -75,7 +74,6 @@ blockedIndefinitelyOnMVar = toException BlockedIndefinitelyOnMVar
-- |The thread is waiting to retry an STM transaction, but there are no
-- other references to any @TVar@s involved, so it can't ever continue.
data BlockedIndefinitelyOnSTM = BlockedIndefinitelyOnSTM
deriving Typeable
instance Exception BlockedIndefinitelyOnSTM
......@@ -90,7 +88,6 @@ blockedIndefinitelyOnSTM = toException BlockedIndefinitelyOnSTM
-- |There are no runnable threads, so the program is deadlocked.
-- The @Deadlock@ exception is raised in the main thread only.
data Deadlock = Deadlock
deriving Typeable
instance Exception Deadlock
......@@ -105,7 +102,6 @@ instance Show Deadlock where
--
-- @since 4.8.0.0
data AllocationLimitExceeded = AllocationLimitExceeded
deriving Typeable
instance Exception AllocationLimitExceeded where
toException = asyncExceptionToException
......@@ -122,7 +118,6 @@ allocationLimitExceeded = toException AllocationLimitExceeded
-- |'assert' was applied to 'False'.
data AssertionFailed = AssertionFailed String
deriving Typeable
instance Exception AssertionFailed
......@@ -135,7 +130,6 @@ instance Show AssertionFailed where
--
-- @since 4.7.0.0
data SomeAsyncException = forall e . Exception e => SomeAsyncException e
deriving Typeable
instance Show SomeAsyncException where
show (SomeAsyncException e) = show e
......@@ -178,7 +172,7 @@ data AsyncException
-- ^This exception is raised by default in the main thread of
-- the program when the user requests to terminate the program
-- via the usual mechanism(s) (e.g. Control-C in the console).
deriving (Eq, Ord, Typeable)
deriving (Eq, Ord)
instance Exception AsyncException where
toException = asyncExceptionToException
......@@ -192,7 +186,7 @@ data ArrayException
| UndefinedElement String
-- ^An attempt was made to evaluate an element of an
-- array that had not been initialized.
deriving (Eq, Ord, Typeable)
deriving (Eq, Ord)
instance Exception ArrayException
......@@ -231,7 +225,7 @@ data ExitCode
-- The exact interpretation of the code is
-- operating-system dependent. In particular, some values
-- may be prohibited (e.g. 0 on a POSIX-compliant system).
deriving (Eq, Ord, Read, Show, Typeable)
deriving (Eq, Ord, Read, Show)
instance Exception ExitCode
......@@ -267,7 +261,6 @@ data IOException
ioe_errno :: Maybe CInt, -- errno leading to this error, if any.
ioe_filename :: Maybe FilePath -- filename the error is related to.
}
deriving Typeable
instance Exception IOException
......
......@@ -2,7 +2,6 @@
{-# LANGUAGE CPP
, NoImplicitPrelude
, BangPatterns
, AutoDeriveTypeable
#-}
{-# OPTIONS_GHC -fno-warn-identities #-}
-- Whether there are identities depends on the platform
......@@ -35,7 +34,6 @@ import GHC.Num
import GHC.Real
import GHC.Show
import GHC.Enum
import Data.Typeable
import GHC.IO
import GHC.IO.IOMode
......@@ -84,7 +82,6 @@ data FD = FD {
fdIsNonBlocking :: {-# UNPACK #-} !Int
#endif
}
deriving Typeable
#ifdef mingw32_HOST_OS
fdIsSocket :: FD -> Bool
......
......@@ -2,7 +2,6 @@
{-# LANGUAGE CPP
, NoImplicitPrelude
, ExistentialQuantification
, AutoDeriveTypeable
#-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
{-# OPTIONS_HADDOCK hide #-}
......@@ -109,8 +108,6 @@ data Handle
!(MVar Handle__) -- The read side
!(MVar Handle__) -- The write side
deriving Typeable
-- NOTES:
-- * A 'FileHandle' is seekable. A 'DuplexHandle' may or may not be
-- seekable.
......@@ -138,7 +135,6 @@ data Handle__
haOtherSide :: Maybe (MVar Handle__) -- ptr to the write side of a
-- duplex handle.
}
deriving Typeable
-- we keep a few spare buffers around in a handle to avoid allocating
-- a new one for each hPutStr. These buffers are *guaranteed* to be the
......
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE NoImplicitPrelude, AutoDeriveTypeable, RoleAnnotations #-}
{-# LANGUAGE NoImplicitPrelude, RoleAnnotations #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
{-# OPTIONS_HADDOCK hide #-}
......@@ -27,7 +27,6 @@ module GHC.IOArray (
import GHC.Base
import GHC.IO
import GHC.Arr
import Data.Typeable.Internal
-- ---------------------------------------------------------------------------
-- | An 'IOArray' is a mutable, boxed, non-strict array in the 'IO' monad.
......@@ -39,7 +38,7 @@ import Data.Typeable.Internal
--
--
newtype IOArray i e = IOArray (STArray RealWorld i e) deriving( Typeable )
newtype IOArray i e = IOArray (STArray RealWorld i e)
-- index type should have a nominal role due to Ix class. See also #9220.
type role IOArray nominal representational
......
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, AutoDeriveTypeable #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
{-# OPTIONS_HADDOCK hide #-}
......@@ -25,13 +25,12 @@ module GHC.IORef (
import GHC.Base
import GHC.STRef
import GHC.IO
import Data.Typeable.Internal( Typeable )
-- ---------------------------------------------------------------------------
-- IORefs
-- |A mutable variable in the 'IO' monad
newtype IORef a = IORef (STRef RealWorld a) deriving( Typeable )
newtype IORef a = IORef (STRef RealWorld a)
-- explicit instance because Haddock can't figure out a derived one
instance Eq (IORef a) where
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, NoImplicitPrelude, BangPatterns, MagicHash, UnboxedTuples,
StandaloneDeriving, AutoDeriveTypeable, NegativeLiterals #-}
StandaloneDeriving, NegativeLiterals #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
......@@ -39,8 +39,6 @@ import GHC.Read
import GHC.Arr
import GHC.Word hiding (uncheckedShiftL64#, uncheckedShiftRL64#)
import GHC.Show
import Data.Typeable
------------------------------------------------------------------------
-- type Int8
......@@ -49,7 +47,7 @@ import Data.Typeable
-- Int8 is represented in the same way as Int. Operations may assume
-- and must ensure that it holds only values from its logical range.
data {-# CTYPE "HsInt8" #-} Int8 = I8# Int# deriving (Eq, Ord, Typeable)
data {-# CTYPE "HsInt8" #-} Int8 = I8# Int# deriving (Eq, Ord)
-- ^ 8-bit signed integer type
instance Show Int8 where
......@@ -210,7 +208,7 @@ instance FiniteBits Int8 where
-- Int16 is represented in the same way as Int. Operations may assume
-- and must ensure that it holds only values from its logical range.
data {-# CTYPE "HsInt16" #-} Int16 = I16# Int# deriving (Eq, Ord, Typeable)
data {-# CTYPE "HsInt16" #-} Int16 = I16# Int# deriving (Eq, Ord)
-- ^ 16-bit signed integer type
instance Show Int16 where
......@@ -376,7 +374,7 @@ instance FiniteBits Int16 where
-- from its logical range.
#endif
data {-# CTYPE "HsInt32" #-} Int32 = I32# Int# deriving (Eq, Ord, Typeable)
data {-# CTYPE "HsInt32" #-} Int32 = I32# Int# deriving (Eq, Ord)
-- ^ 32-bit signed integer type
instance Show Int32 where
......@@ -553,7 +551,7 @@ instance Ix Int32 where
#if WORD_SIZE_IN_BITS < 64
data {-# CTYPE "HsInt64" #-} Int64 = I64# Int64# deriving( Typeable )
data {-# CTYPE "HsInt64" #-} Int64 = I64# Int64#
-- ^ 64-bit signed integer type
instance Eq Int64 where
......@@ -728,7 +726,7 @@ a `iShiftRA64#` b | isTrue# (b >=# 64#) = if isTrue# (a `ltInt64#` (intToInt64#
-- Operations may assume and must ensure that it holds only values
-- from its logical range.
data {-# CTYPE "HsInt64" #-} Int64 = I64# Int# deriving (Eq, Ord, Typeable)
data {-# CTYPE "HsInt64" #-} Int64 = I64# Int# deriving (Eq, Ord)
-- ^ 64-bit signed integer type
instance Show Int64 where
......
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, UnboxedTuples, AutoDeriveTypeable #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, UnboxedTuples #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
{-# OPTIONS_HADDOCK hide #-}
......@@ -33,9 +33,8 @@ module GHC.MVar (
) where
import GHC.Base
import Data.Typeable
data MVar a = MVar (MVar# RealWorld a) deriving( Typeable )
data MVar a = MVar (MVar# RealWorld a)
{- ^
An 'MVar' (pronounced \"em-var\") is a synchronising variable, used
for communication between concurrent threads. It can be thought of
......
{-# LANGUAGE AutoDeriveTypeable #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
......
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE NoImplicitPrelude
, DeriveDataTypeable
, MagicHash
, UnboxedTuples
#-}
......@@ -31,7 +30,6 @@ module GHC.Stable (
import GHC.Ptr
import GHC.Base
import Data.Typeable.Internal
-----------------------------------------------------------------------------
-- Stable Pointers
......@@ -48,7 +46,6 @@ A value of type @StablePtr a@ is a stable pointer to a Haskell
expression of type @a@.
-}
data {-# CTYPE "HsStablePtr" #-} StablePtr a = StablePtr (StablePtr# a)
deriving( Typeable )
-- |
-- Create a stable pointer referring to the given Haskell value.
......
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE ExistentialQuantification #-}
......@@ -41,7 +40,6 @@ module GHC.StaticPtr
, staticPtrKeys
) where
import Data.Typeable (Typeable)
import Foreign.C.Types (CInt(..))
import Foreign.Marshal (allocaArray, peekArray, withArray)
import Foreign.Ptr (castPtr)
......@@ -52,7 +50,6 @@ import GHC.Fingerprint (Fingerprint(..))
-- | A reference to a value of type 'a'.
data StaticPtr a = StaticPtr StaticKey StaticPtrInfo a
deriving Typeable
-- | Dereferences a static pointer.
deRefStaticPtr :: StaticPtr a -> a
......@@ -96,7 +93,7 @@ data StaticPtrInfo = StaticPtrInfo
-- @(Line, Column)@ pair.
, spInfoSrcLoc :: (Int, Int)
}
deriving (Show, Typeable)
deriving (Show)
-- | 'StaticPtrInfo' of the given 'StaticPtr'.
staticPtrInfo :: StaticPtr a -> StaticPtrInfo
......
......@@ -3,7 +3,6 @@
, BangPatterns
, MagicHash
, UnboxedTuples
, DeriveDataTypeable
, StandaloneDeriving
#-}
{-# OPTIONS_HADDOCK hide #-}
......@@ -31,7 +30,6 @@ module GHC.Weak (
) where
import GHC.Base
import Data.Typeable
{-|
A weak pointer object with a key and a value. The value has type @v@.
......@@ -91,7 +89,7 @@ finalizer to the box itself fails when the outer box is optimised away
by the compiler.
-}
data Weak v = Weak (Weak# v) deriving Typeable
data Weak v = Weak (Weak# v)
-- | Establishes a weak pointer to @k@, with value @v@ and a finalizer.
--
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE AutoDeriveTypeable, StandaloneDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE MagicHash #-}
#if !defined(__PARALLEL_HASKELL__)
{-# LANGUAGE UnboxedTuples #-}
......@@ -38,8 +38,6 @@ module System.Mem.StableName (
eqStableName
) where
import Data.Typeable
import GHC.IO ( IO(..) )
import GHC.Base ( Int(..), StableName#, makeStableName#
, eqStableName#, stableNameToInt# )
......@@ -76,7 +74,6 @@ import GHC.Base ( Int(..), StableName#, makeStableName#
-}
data StableName a = StableName (StableName# a)
deriving Typeable
-- | Makes a 'StableName' for an arbitrary object. The object passed as
-- the first argument is not evaluated by 'makeStableName'.
......
......@@ -4,7 +4,7 @@
, MagicHash
, GeneralizedNewtypeDeriving
#-}
{-# LANGUAGE AutoDeriveTypeable, StandaloneDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
-----------------------------------------------------------------------------
-- |
......@@ -92,7 +92,6 @@ module System.Posix.Types (
import Foreign
import Foreign.C
import Data.Typeable
-- import Data.Bits
import GHC.Base
......
{-# LANGUAGE Safe #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE AutoDeriveTypeable, StandaloneDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
-------------------------------------------------------------------------------
-- |
......@@ -29,14 +29,13 @@ import Control.Exception (Exception(..), handleJust, bracket,
uninterruptibleMask_,
asyncExceptionToException,
asyncExceptionFromException)
import Data.Typeable
import Data.Unique (Unique, newUnique)
-- An internal type that is thrown as a dynamic exception to
-- interrupt the running IO computation when the timeout has
-- expired.
newtype Timeout = Timeout Unique deriving (Eq, Typeable)
newtype Timeout = Timeout Unique deriving (Eq)
instance Show Timeout where
show _ = "<<timeout>>"
......
......@@ -60,7 +60,6 @@ Flag integer-gmp2
Library
default-language: Haskell2010
other-extensions:
AutoDeriveTypeable
BangPatterns
CApiFFI
CPP
......
......@@ -16,7 +16,7 @@
-- // GHC can derive any class for a newtype, so we make use of that here...
#define ARITHMETIC_CLASSES Eq,Ord,Num,Enum,Storable,Real,Typeable
#define ARITHMETIC_CLASSES Eq,Ord,Num,Enum,Storable,Real
#define INTEGRAL_CLASSES Bounded,Integral,Bits,FiniteBits
#define FLOATING_CLASSES Fractional,Floating,RealFrac,RealFloat
......
......@@ -33,7 +33,6 @@ data BSIODevice
= BSIODevice
ByteString
(MVar Int) -- Position
deriving Typeable
newBsDevice :: ByteString -> IO BSIODevice
newBsDevice bs = BSIODevice bs <$> newMVar 0
......
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