ghc-9.15: The GHC API
Safe HaskellNone
LanguageGHC2024

Language.Haskell.Syntax.Decls.Overlap

Description

Data-type describing the overlap annotations for instances.

Synopsis

Documentation

data OverlapMode pass Source #

The status of overlapping instances (including no overlap) for a type.

Constructors

NoOverlap (XOverlapMode pass)

This instance must not overlap another NoOverlap instance. However, it may be overlapped by Overlapping instances, and it may overlap Overlappable instances.

Overlappable (XOverlapMode pass)

Silently ignore this instance if you find a more specific one that matches the constraint you are trying to resolve

Example: constraint (Foo [Int]) instance Foo [Int] instance {-# OVERLAPPABLE #-} Foo [a]

Since the second instance has the Overlappable flag, the first instance will be chosen (otherwise its ambiguous which to choose)

Overlapping (XOverlapMode pass)

Silently ignore any more general instances that may be used to solve the constraint.

Example: constraint (Foo [Int]) instance {-# OVERLAPPING #-} Foo [Int] instance Foo [a]

Since the first instance has the Overlapping flag, the second---more general---instance will be ignored (otherwise it is ambiguous which to choose)

Overlaps (XOverlapMode pass)

Equivalent to having both Overlapping and Overlappable flags.

Incoherent (XOverlapMode pass)

Behave like Overlappable and Overlapping, and in addition pick an arbitrary one if there are multiple matching candidates, and don't worry about later instantiation

Example: constraint (Foo [b]) instance {-# INCOHERENT -} Foo [Int] instance Foo [a] Without the Incoherent flag, we'd complain that instantiating b would change which instance was chosen. See also Note [Incoherent instances] in GHC.Core.InstEnv

NonCanonical (XOverlapMode pass)

Behave like Incoherent, but the instance choice is observable by the program behaviour. See Note [Coherence and specialisation: overview].

We don't have surface syntax for the distinction between Incoherent and NonCanonical instances; instead, the flag `-f{no-}specialise-incoherents` (on by default) controls whether INCOHERENT instances are regarded as Incoherent or NonCanonical.

XOverlapMode !(XXOverlapMode pass)

The Trees That Grow extension point constructor.

Instances

Instances details
NFData (OverlapMode (GhcPass p)) Source # 
Instance details

Defined in GHC.Hs.Decls.Overlap

Methods

rnf :: OverlapMode (GhcPass p) -> () Source #

(NFData (XOverlapMode pass), NFData (XXOverlapMode pass)) => NFData (OverlapMode pass) Source # 
Instance details

Defined in Language.Haskell.Syntax.Decls.Overlap

Methods

rnf :: OverlapMode pass -> () Source #

Binary (OverlapMode (GhcPass p)) Source # 
Instance details

Defined in GHC.Hs.Decls.Overlap

Outputable (OverlapMode p) Source # 
Instance details

Defined in GHC.Utils.Outputable

Methods

ppr :: OverlapMode p -> SDoc Source #

(Eq (XOverlapMode pass), Eq (XXOverlapMode pass)) => Eq (OverlapMode pass) Source # 
Instance details

Defined in Language.Haskell.Syntax.Decls.Overlap

Methods

(==) :: OverlapMode pass -> OverlapMode pass -> Bool Source #

(/=) :: OverlapMode pass -> OverlapMode pass -> Bool Source #

Data (OverlapMode GhcPs) Source # 
Instance details

Defined in GHC.Hs.Instances

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OverlapMode GhcPs -> c (OverlapMode GhcPs) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (OverlapMode GhcPs) Source #

toConstr :: OverlapMode GhcPs -> Constr Source #

dataTypeOf :: OverlapMode GhcPs -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (OverlapMode GhcPs)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OverlapMode GhcPs)) Source #

gmapT :: (forall b. Data b => b -> b) -> OverlapMode GhcPs -> OverlapMode GhcPs Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OverlapMode GhcPs -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OverlapMode GhcPs -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> OverlapMode GhcPs -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OverlapMode GhcPs -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OverlapMode GhcPs -> m (OverlapMode GhcPs) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OverlapMode GhcPs -> m (OverlapMode GhcPs) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OverlapMode GhcPs -> m (OverlapMode GhcPs) Source #

Data (OverlapMode GhcRn) Source # 
Instance details

Defined in GHC.Hs.Instances

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OverlapMode GhcRn -> c (OverlapMode GhcRn) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (OverlapMode GhcRn) Source #

toConstr :: OverlapMode GhcRn -> Constr Source #

dataTypeOf :: OverlapMode GhcRn -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (OverlapMode GhcRn)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OverlapMode GhcRn)) Source #

gmapT :: (forall b. Data b => b -> b) -> OverlapMode GhcRn -> OverlapMode GhcRn Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OverlapMode GhcRn -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OverlapMode GhcRn -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> OverlapMode GhcRn -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OverlapMode GhcRn -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OverlapMode GhcRn -> m (OverlapMode GhcRn) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OverlapMode GhcRn -> m (OverlapMode GhcRn) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OverlapMode GhcRn -> m (OverlapMode GhcRn) Source #

Data (OverlapMode GhcTc) Source # 
Instance details

Defined in GHC.Hs.Instances

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OverlapMode GhcTc -> c (OverlapMode GhcTc) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (OverlapMode GhcTc) Source #

toConstr :: OverlapMode GhcTc -> Constr Source #

dataTypeOf :: OverlapMode GhcTc -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (OverlapMode GhcTc)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OverlapMode GhcTc)) Source #

gmapT :: (forall b. Data b => b -> b) -> OverlapMode GhcTc -> OverlapMode GhcTc Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OverlapMode GhcTc -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OverlapMode GhcTc -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> OverlapMode GhcTc -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> OverlapMode GhcTc -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> OverlapMode GhcTc -> m (OverlapMode GhcTc) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OverlapMode GhcTc -> m (OverlapMode GhcTc) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OverlapMode GhcTc -> m (OverlapMode GhcTc) Source #

type Anno (OverlapMode (GhcPass p)) Source # 
Instance details

Defined in GHC.Hs.Decls