diff options
Diffstat (limited to 'compiler/basicTypes/BasicTypes.hs')
-rw-r--r-- | compiler/basicTypes/BasicTypes.hs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index aab0528d1c..0429a43f5d 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -41,6 +41,8 @@ module BasicTypes( TopLevelFlag(..), isTopLevel, isNotTopLevel, + DerivStrategy(..), + OverlapFlag(..), OverlapMode(..), setOverlapModeMaybe, hasOverlappingFlag, hasOverlappableFlag, hasIncoherentFlag, @@ -479,6 +481,30 @@ instance Outputable Origin where {- ************************************************************************ * * + Deriving strategies +* * +************************************************************************ +-} + +-- | Which technique the user explicitly requested when deriving an instance. +data DerivStrategy + -- See Note [Deriving strategies] in TcDeriv + = DerivStock -- ^ GHC's \"standard\" strategy, which is to implement a + -- custom instance for the data type. This only works for + -- certain types that GHC knows about (e.g., 'Eq', 'Show', + -- 'Functor' when @-XDeriveFunctor@ is enabled, etc.) + | DerivAnyclass -- ^ @-XDeriveAnyClass@ + | DerivNewtype -- ^ @-XGeneralizedNewtypeDeriving@ + deriving (Eq, Data) + +instance Outputable DerivStrategy where + ppr DerivStock = text "stock" + ppr DerivAnyclass = text "anyclass" + ppr DerivNewtype = text "newtype" + +{- +************************************************************************ +* * Instance overlap flag * * ************************************************************************ |