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
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE AutoDeriveTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NoImplicitPrelude #-}
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE AutoDeriveTypeable, StandaloneDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
-----------------------------------------------------------------------------
-- |
......@@ -37,7 +37,6 @@ module Control.Concurrent.Chan
import System.IO.Unsafe ( unsafeInterleaveIO )
import Control.Concurrent.MVar
import Control.Exception (mask_)
import Data.Typeable
#define _UPK_(x) {-# UNPACK #-} !(x)
......@@ -49,7 +48,7 @@ import Data.Typeable
data Chan a
= Chan _UPK_(MVar (Stream a))
_UPK_(MVar (Stream a)) -- Invariant: the Stream a is always an empty MVar
deriving (Eq,Typeable)
deriving (Eq)
type Stream a = MVar (ChItem a)
......
{-# LANGUAGE Safe #-}
{-# LANGUAGE AutoDeriveTypeable, BangPatterns #-}
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
-----------------------------------------------------------------------------
......
{-# LANGUAGE Safe #-}
{-# LANGUAGE AutoDeriveTypeable, BangPatterns #-}
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
-----------------------------------------------------------------------------
......@@ -28,7 +28,6 @@ module Control.Concurrent.QSemN
import Control.Concurrent.MVar ( MVar, newEmptyMVar, takeMVar, tryTakeMVar
, putMVar, newMVar
, tryPutMVar, isEmptyMVar)
import Data.Typeable
import Control.Exception
import Data.Maybe
......@@ -43,7 +42,6 @@ import Data.Maybe
-- is safe; it never loses any of the resource.
--
data QSemN = QSemN !(MVar (Int, [(Int, MVar ())], [(Int, MVar ())]))
deriving Typeable
-- The semaphore state (i, xs, ys):
--
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash #-}
{-# LANGUAGE AutoDeriveTypeable, StandaloneDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
-----------------------------------------------------------------------------
-- |
......@@ -104,7 +104,6 @@ import GHC.Show
-- import GHC.Exception hiding ( Exception )
import GHC.Conc.Sync
import Data.Dynamic
import Data.Either
-----------------------------------------------------------------------------
......@@ -297,7 +296,7 @@ bracketOnError before after thing =
-- |A pattern match failed. The @String@ gives information about the
-- source location of the pattern.
data PatternMatchFail = PatternMatchFail String deriving Typeable
data PatternMatchFail = PatternMatchFail String
instance Show PatternMatchFail where
showsPrec _ (PatternMatchFail err) = showString err
......@@ -311,7 +310,7 @@ instance Exception PatternMatchFail
-- multiple constructors, where some fields are in one constructor
-- but not another. The @String@ gives information about the source
-- location of the record selector.
data RecSelError = RecSelError String deriving Typeable
data RecSelError = RecSelError String
instance Show RecSelError where
showsPrec _ (RecSelError err) = showString err
......@@ -323,7 +322,7 @@ instance Exception RecSelError
-- |An uninitialised record field was used. The @String@ gives
-- information about the source location where the record was
-- constructed.
data RecConError = RecConError String deriving Typeable
data RecConError = RecConError String
instance Show RecConError where
showsPrec _ (RecConError err) = showString err
......@@ -337,7 +336,7 @@ instance Exception RecConError
-- multiple constructors, where some fields are in one constructor
-- but not another. The @String@ gives information about the source
-- location of the record update.
data RecUpdError = RecUpdError String deriving Typeable
data RecUpdError = RecUpdError String
instance Show RecUpdError where
showsPrec _ (RecUpdError err) = showString err
......@@ -349,7 +348,7 @@ instance Exception RecUpdError
-- |A class method without a definition (neither a default definition,
-- nor a definition in the appropriate instance) was called. The
-- @String@ gives information about which method it was.
data NoMethodError = NoMethodError String deriving Typeable
data NoMethodError = NoMethodError String
instance Show NoMethodError where
showsPrec _ (NoMethodError err) = showString err
......@@ -362,7 +361,7 @@ instance Exception NoMethodError
-- guaranteed not to terminate. Note that there is no guarantee that
-- the runtime system will notice whether any given computation is
-- guaranteed to terminate or not.
data NonTermination = NonTermination deriving Typeable
data NonTermination = NonTermination
instance Show NonTermination where
showsPrec _ NonTermination = showString "<<loop>>"
......@@ -373,7 +372,7 @@ instance Exception NonTermination
-- |Thrown when the program attempts to call @atomically@, from the @stm@
-- package, inside another call to @atomically@.
data NestedAtomically = NestedAtomically deriving Typeable
data NestedAtomically = NestedAtomically
instance Show NestedAtomically where
showsPrec _ NestedAtomically = showString "Control.Concurrent.STM.atomically was nested"
......
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE AutoDeriveTypeable #-}
{-# LANGUAGE StandaloneDeriving #-}
-----------------------------------------------------------------------------
......@@ -34,7 +34,6 @@ module Data.Complex
) where
import Data.Typeable
import Data.Data (Data)
import Foreign (Storable, castPtr, peek, poke, pokeElemOff, peekElemOff, sizeOf,
alignment)
......@@ -52,7 +51,7 @@ infix 6 :+
data Complex a
= !a :+ !a -- ^ forms a complex number from its real and imaginary
-- rectangular components.
deriving (Eq, Show, Read, Data, Typeable)
deriving (Eq, Show, Read, Data)
-- -----------------------------------------------------------------------------
-- Functions over Complex
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE RankNTypes, ScopedTypeVariables, PolyKinds, StandaloneDeriving,
AutoDeriveTypeable, TypeOperators, GADTs, FlexibleInstances #-}
TypeOperators, GADTs, FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE AutoDeriveTypeable, StandaloneDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
-----------------------------------------------------------------------------
-- |
......@@ -68,7 +68,6 @@ import GHC.Exception
of the object\'s type; useful for debugging.
-}
data Dynamic = Dynamic TypeRep Obj
deriving Typeable
instance Show Dynamic where
-- the instance just prints the type representation.
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE AutoDeriveTypeable, StandaloneDeriving #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, TypeOperators, UndecidableInstances #-}
-----------------------------------------------------------------------------
......@@ -31,7 +31,6 @@ import GHC.Base
import GHC.Show
import GHC.Read
import Data.Typeable
import Data.Type.Equality
-- $setup
......@@ -123,7 +122,7 @@ Left "parse error"
-}
data Either a b = Left a | Right b
deriving (Eq, Ord, Read, Show, Typeable)
deriving (Eq, Ord, Read, Show)
instance Functor (Either a) where
fmap _ (Left x) = Left x
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE AutoDeriveTypeable #-}
-----------------------------------------------------------------------------
-- |
......
{-# LANGUAGE AutoDeriveTypeable #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE Trustworthy #-}
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE AutoDeriveTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PolyKinds #-}
......
......@@ -3,7 +3,6 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE NoImplicitPrelude #-}
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE MagicHash, AutoDeriveTypeable #-}
{-# LANGUAGE MagicHash #-}
-----------------------------------------------------------------------------
-- |
......@@ -26,12 +26,11 @@ import System.IO.Unsafe (unsafePerformIO)
import GHC.Base
import GHC.Num
import Data.Typeable
import Data.IORef
-- | An abstract unique object. Objects of type 'Unique' may be
-- compared for equality and ordering and hashed into 'Int'.
newtype Unique = Unique Integer deriving (Eq,Ord,Typeable)
newtype Unique = Unique Integer deriving (Eq,Ord)
uniqSource :: IORef Integer
uniqSource = unsafePerformIO (newIORef 0)
......
{-# LANGUAGE Safe #-}
{-# LANGUAGE AutoDeriveTypeable #-}
{-# LANGUAGE NoImplicitPrelude #-}
-----------------------------------------------------------------------------
......@@ -44,7 +43,6 @@ import Data.Int ( Int )
import Data.List
import Data.Ord
import Data.String ( String )
import Data.Typeable ( Typeable )
import GHC.Read
import GHC.Show
import Text.ParserCombinators.ReadP
......@@ -93,7 +91,7 @@ data Version =
-- The interpretation of the list of tags is entirely dependent
-- on the entity that this version applies to.
}
deriving (Read,Show,Typeable)
deriving (Read,Show)
{-# DEPRECATED versionTags "See GHC ticket #2496" #-}
-- TODO. Remove all references to versionTags in GHC 7.12 release.
......
{-# LANGUAGE AutoDeriveTypeable #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE EmptyCase #-}
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, GeneralizedNewtypeDeriving,
AutoDeriveTypeable, StandaloneDeriving #-}
StandaloneDeriving #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
-- XXX -fno-warn-unused-binds stops us warning about unused constructors,
-- but really we should just remove them if we don't want them
......@@ -73,7 +73,6 @@ import Foreign.Storable
import Data.Bits ( Bits(..), FiniteBits(..) )
import Data.Int ( Int8, Int16, Int32, Int64 )
import Data.Word ( Word8, Word16, Word32, Word64 )
import Data.Typeable
import GHC.Base
import GHC.Float
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, GeneralizedNewtypeDeriving,
AutoDeriveTypeable, StandaloneDeriving #-}
StandaloneDeriving #-}
-----------------------------------------------------------------------------
-- |
......@@ -58,7 +58,6 @@ import GHC.Show
import GHC.Enum
import Data.Bits
import Data.Typeable
import Foreign.Storable ( Storable(..) )
-- | Release the storage associated with the given 'FunPtr', which
......
......@@ -5,7 +5,6 @@
, MagicHash
, UnboxedTuples
, UnliftedFFITypes
, DeriveDataTypeable
, StandaloneDeriving
, RankNTypes
#-}
......@@ -98,10 +97,6 @@ module GHC.Conc.Sync
import Foreign
import Foreign.C
#ifdef mingw32_HOST_OS
import Data.Typeable
#endif
#ifndef mingw32_HOST_OS
import Data.Dynamic
#endif
......@@ -128,7 +123,7 @@ infixr 0 `par`, `pseq`
-- 'ThreadId', 'par', and 'fork'
-----------------------------------------------------------------------------
data ThreadId = ThreadId ThreadId# deriving( Typeable )
data ThreadId = ThreadId ThreadId#
-- ToDo: data ThreadId = ThreadId (Weak ThreadId#)
-- But since ThreadId# is unlifted, the Weak type must use open
-- type variables.
......@@ -622,7 +617,6 @@ mkWeakThreadId t@(ThreadId t#) = IO $ \s ->
-- |A monad supporting atomic memory transactions.
newtype STM a = STM (State# RealWorld -> (# State# RealWorld, a #))
deriving Typeable
unSTM :: STM a -> (State# RealWorld -> (# State# RealWorld, a #))
unSTM (STM a) = a
......@@ -772,7 +766,6 @@ always i = alwaysSucceeds ( do v <- i
-- |Shared memory locations that support atomic memory transactions.
data TVar a = TVar (TVar# RealWorld a)
deriving Typeable
instance Eq (TVar a) where
(TVar tvar1#) == (TVar tvar2#) = isTrue# (sameTVar# tvar1# tvar2#)
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, UnboxedTuples,
AutoDeriveTypeable #-}
{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, UnboxedTuples #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
{-# OPTIONS_HADDOCK not-home #-}
......@@ -280,7 +279,7 @@ data ConsoleEvent
-- these are sent to Services only.
| Logoff
| Shutdown
deriving (Eq, Ord, Enum, Show, Read, Typeable)
deriving (Eq, Ord, Enum, Show, Read)
start_console_handler :: Word32 -> IO ()
start_console_handler r =
......
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