Safe Haskell  None 

Language  Haskell2010 
Synopsis
 type DFunId = Id
 type InstMatch = (ClsInst, [DFunInstType])
 type ClsInstLookupResult = ([InstMatch], [ClsInst], [InstMatch])
 data OverlapFlag = OverlapFlag {}
 data OverlapMode
 setOverlapModeMaybe :: OverlapFlag > Maybe OverlapMode > OverlapFlag
 data ClsInst = ClsInst {}
 type DFunInstType = Maybe Type
 pprInstance :: ClsInst > SDoc
 pprInstanceHdr :: ClsInst > SDoc
 pprInstances :: [ClsInst] > SDoc
 instanceHead :: ClsInst > ([TyVar], Class, [Type])
 instanceSig :: ClsInst > ([TyVar], [Type], Class, [Type])
 mkLocalInstance :: DFunId > OverlapFlag > [TyVar] > Class > [Type] > ClsInst
 mkImportedInstance :: Name > [Maybe Name] > Name > DFunId > OverlapFlag > IsOrphan > ClsInst
 instanceDFunId :: ClsInst > DFunId
 updateClsInstDFun :: (DFunId > DFunId) > ClsInst > ClsInst
 instanceRoughTcs :: ClsInst > [Maybe Name]
 fuzzyClsInstCmp :: ClsInst > ClsInst > Ordering
 orphNamesOfClsInst :: ClsInst > NameSet
 data InstEnvs = InstEnvs {}
 type VisibleOrphanModules = ModuleSet
 type InstEnv = UniqDFM ClsInstEnv
 emptyInstEnv :: InstEnv
 extendInstEnv :: InstEnv > ClsInst > InstEnv
 deleteFromInstEnv :: InstEnv > ClsInst > InstEnv
 deleteDFunFromInstEnv :: InstEnv > DFunId > InstEnv
 identicalClsInstHead :: ClsInst > ClsInst > Bool
 extendInstEnvList :: InstEnv > [ClsInst] > InstEnv
 lookupUniqueInstEnv :: InstEnvs > Class > [Type] > Either MsgDoc (ClsInst, [Type])
 lookupInstEnv :: Bool > InstEnvs > Class > [Type] > ClsInstLookupResult
 instEnvElts :: InstEnv > [ClsInst]
 memberInstEnv :: InstEnv > ClsInst > Bool
 instIsVisible :: VisibleOrphanModules > ClsInst > Bool
 classInstances :: InstEnvs > Class > [ClsInst]
 instanceBindFun :: TyCoVar > BindFlag
 instanceCantMatch :: [Maybe Name] > [Maybe Name] > Bool
 roughMatchTcs :: [Type] > [Maybe Name]
 isOverlappable :: ClsInst > Bool
 isOverlapping :: ClsInst > Bool
 isIncoherent :: ClsInst > Bool
Documentation
type InstMatch = (ClsInst, [DFunInstType]) Source #
data OverlapFlag Source #
The semantics allowed for overlapping instances for a particular
instance. See Note [Safe Haskell isSafeOverlap] (in hs
) for a
explanation of the isSafeOverlap
field.
AnnKeywordId
:AnnOpen
'{# OVERLAPPABLE'
or'{# OVERLAPPING'
or'{# OVERLAPS'
or'{# INCOHERENT'
,AnnClose
`#}`
,
Instances
Eq OverlapFlag #  
Defined in BasicTypes (==) :: OverlapFlag > OverlapFlag > Bool # (/=) :: OverlapFlag > OverlapFlag > Bool #  
Data OverlapFlag #  
Defined in BasicTypes gfoldl :: (forall d b. Data d => c (d > b) > d > c b) > (forall g. g > c g) > OverlapFlag > c OverlapFlag Source # gunfold :: (forall b r. Data b => c (b > r) > c r) > (forall r. r > c r) > Constr > c OverlapFlag Source # toConstr :: OverlapFlag > Constr Source # dataTypeOf :: OverlapFlag > DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) > Maybe (c OverlapFlag) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) > Maybe (c OverlapFlag) Source # gmapT :: (forall b. Data b => b > b) > OverlapFlag > OverlapFlag Source # gmapQl :: (r > r' > r) > r > (forall d. Data d => d > r') > OverlapFlag > r Source # gmapQr :: forall r r'. (r' > r > r) > r > (forall d. Data d => d > r') > OverlapFlag > r Source # gmapQ :: (forall d. Data d => d > u) > OverlapFlag > [u] Source # gmapQi :: Int > (forall d. Data d => d > u) > OverlapFlag > u Source # gmapM :: Monad m => (forall d. Data d => d > m d) > OverlapFlag > m OverlapFlag Source # gmapMp :: MonadPlus m => (forall d. Data d => d > m d) > OverlapFlag > m OverlapFlag Source # gmapMo :: MonadPlus m => (forall d. Data d => d > m d) > OverlapFlag > m OverlapFlag Source #  
Outputable OverlapFlag #  
Defined in BasicTypes  
Binary OverlapFlag #  
data OverlapMode Source #
NoOverlap SourceText  This instance must not overlap another 
Overlappable SourceText  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 {} Foo [a] Since the second instance has the Overlappable flag, the first instance will be chosen (otherwise its ambiguous which to choose) 
Overlapping SourceText  Silently ignore any more general instances that may be used to solve the constraint. Example: constraint (Foo [Int]) instance {} Foo [Int] instance Foo [a] Since the first instance has the Overlapping flag, the secondmore generalinstance will be ignored (otherwise it is ambiguous which to choose) 
Overlaps SourceText  Equivalent to having both 
Incoherent SourceText  Behave like Overlappable and Overlapping, and in addition pick an 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 
Instances
Eq OverlapMode #  
Defined in BasicTypes (==) :: OverlapMode > OverlapMode > Bool # (/=) :: OverlapMode > OverlapMode > Bool #  
Data OverlapMode #  
Defined in BasicTypes gfoldl :: (forall d b. Data d => c (d > b) > d > c b) > (forall g. g > c g) > OverlapMode > c OverlapMode Source # gunfold :: (forall b r. Data b => c (b > r) > c r) > (forall r. r > c r) > Constr > c OverlapMode Source # toConstr :: OverlapMode > Constr Source # dataTypeOf :: OverlapMode > DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) > Maybe (c OverlapMode) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) > Maybe (c OverlapMode) Source # gmapT :: (forall b. Data b => b > b) > OverlapMode > OverlapMode Source # gmapQl :: (r > r' > r) > r > (forall d. Data d => d > r') > OverlapMode > r Source # gmapQr :: forall r r'. (r' > r > r) > r > (forall d. Data d => d > r') > OverlapMode > r Source # gmapQ :: (forall d. Data d => d > u) > OverlapMode > [u] Source # gmapQi :: Int > (forall d. Data d => d > u) > OverlapMode > u Source # gmapM :: Monad m => (forall d. Data d => d > m d) > OverlapMode > m OverlapMode Source # gmapMp :: MonadPlus m => (forall d. Data d => d > m d) > OverlapMode > m OverlapMode Source # gmapMo :: MonadPlus m => (forall d. Data d => d > m d) > OverlapMode > m OverlapMode Source #  
Outputable OverlapMode #  
Defined in BasicTypes  
Binary OverlapMode #  
A typeclass instance. Note that there is some tricky laziness at work here. See Note [ClsInst laziness and the roughmatch fields] for more details.
ClsInst  

Instances
Data ClsInst #  
Defined in InstEnv gfoldl :: (forall d b. Data d => c (d > b) > d > c b) > (forall g. g > c g) > ClsInst > c ClsInst Source # gunfold :: (forall b r. Data b => c (b > r) > c r) > (forall r. r > c r) > Constr > c ClsInst Source # toConstr :: ClsInst > Constr Source # dataTypeOf :: ClsInst > DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) > Maybe (c ClsInst) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) > Maybe (c ClsInst) Source # gmapT :: (forall b. Data b => b > b) > ClsInst > ClsInst Source # gmapQl :: (r > r' > r) > r > (forall d. Data d => d > r') > ClsInst > r Source # gmapQr :: forall r r'. (r' > r > r) > r > (forall d. Data d => d > r') > ClsInst > r Source # gmapQ :: (forall d. Data d => d > u) > ClsInst > [u] Source # gmapQi :: Int > (forall d. Data d => d > u) > ClsInst > u Source # gmapM :: Monad m => (forall d. Data d => d > m d) > ClsInst > m ClsInst Source # gmapMp :: MonadPlus m => (forall d. Data d => d > m d) > ClsInst > m ClsInst Source # gmapMo :: MonadPlus m => (forall d. Data d => d > m d) > ClsInst > m ClsInst Source #  
Outputable ClsInst #  
NamedThing ClsInst #  
type DFunInstType = Maybe Type Source #
pprInstance :: ClsInst > SDoc Source #
pprInstanceHdr :: ClsInst > SDoc Source #
pprInstances :: [ClsInst] > SDoc Source #
mkLocalInstance :: DFunId > OverlapFlag > [TyVar] > Class > [Type] > ClsInst Source #
instanceDFunId :: ClsInst > DFunId Source #
fuzzyClsInstCmp :: ClsInst > ClsInst > Ordering Source #
A fuzzy comparison function for class instances, intended for sorting instances before displaying them to the user.
orphNamesOfClsInst :: ClsInst > NameSet Source #
Collects the names of concrete types and type constructors that make up the head of a class instance. For instance, given `class Foo a b`:
`instance Foo (Either (Maybe Int) a) Bool` would yield [Either, Maybe, Int, Bool]
Used in the implementation of ":info" in GHCi.
The tcSplitSigmaTy
is because of
instance Foo a => Baz T where ...
The decl is an orphan if Baz and T are both not locally defined,
even if Foo *is* locally defined
InstEnvs
represents the combination of the global type class instance
environment, the local type class instance environment, and the set of
transitively reachable orphan modules (according to what modules have been
directly imported) used to test orphan instance visibility.
type VisibleOrphanModules = ModuleSet Source #
Set of visible orphan modules, according to what modules have been directly imported. This is based off of the dep_orphs field, which records transitively reachable orphan modules (modules that define orphan instances).
identicalClsInstHead :: ClsInst > ClsInst > Bool Source #
True when when the instance heads are the same e.g. both are Eq [(a,b)] Used for overriding in GHCi Obviously should be insenstive to alpharenaming
lookupUniqueInstEnv :: InstEnvs > Class > [Type] > Either MsgDoc (ClsInst, [Type]) Source #
Look up an instance in the given instance environment. The given class application must match exactly one instance and the match may not contain any flexi type variables. If the lookup is unsuccessful, yield 'Left errorMessage'.
lookupInstEnv :: Bool > InstEnvs > Class > [Type] > ClsInstLookupResult Source #
See Note [Rules for instance lookup] ^ See Note [Safe Haskell Overlapping Instances] in TcSimplify ^ See Note [Safe Haskell Overlapping Instances Implementation] in TcSimplify
instEnvElts :: InstEnv > [ClsInst] Source #
memberInstEnv :: InstEnv > ClsInst > Bool Source #
Checks for an exact match of ClsInst in the instance environment. We use this when we do signature checking in TcRnDriver
instIsVisible :: VisibleOrphanModules > ClsInst > Bool Source #
Test if an instance is visible, by checking that its origin module
is in VisibleOrphanModules
.
See Note [Instance lookup and orphan instances]
instanceBindFun :: TyCoVar > BindFlag Source #
isOverlappable :: ClsInst > Bool Source #
isOverlapping :: ClsInst > Bool Source #
isIncoherent :: ClsInst > Bool Source #