Safe Haskell | None |
---|---|
Language | Haskell2010 |
Type class entailment
Synopsis
- type InstanceContext = Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))
- data SolverOptions = SolverOptions {}
- replaceTypeClassDictionaries :: forall m. (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => Bool -> Expr -> m (Expr, [(Ident, InstanceContext, SourceConstraint)])
- newDictionaries :: MonadState CheckState m => [(Qualified (ProperName ClassName), Integer)] -> Qualified Ident -> SourceConstraint -> m [NamedDict]
- entails :: forall m. (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => SolverOptions -> SourceConstraint -> InstanceContext -> [ErrorMessageHint] -> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr
Documentation
type InstanceContext = Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict))) Source #
The InstanceContext
tracks those constraints which can be satisfied.
data SolverOptions Source #
Options for the constraint solver
SolverOptions | |
|
replaceTypeClassDictionaries :: forall m. (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) => Bool -> Expr -> m (Expr, [(Ident, InstanceContext, SourceConstraint)]) Source #
Replace type class dictionary placeholders with inferred type class dictionaries
newDictionaries :: MonadState CheckState m => [(Qualified (ProperName ClassName), Integer)] -> Qualified Ident -> SourceConstraint -> m [NamedDict] Source #
Add a dictionary for the constraint to the scope, and dictionaries for all implied superclass instances.
:: (MonadState CheckState m, MonadError MultipleErrors m, MonadWriter MultipleErrors m, MonadSupply m) | |
=> SolverOptions | Solver options |
-> SourceConstraint | The constraint to solve |
-> InstanceContext | The contexts in which to solve the constraint |
-> [ErrorMessageHint] | Error message hints to apply to any instance errors |
-> WriterT (Any, [(Ident, InstanceContext, SourceConstraint)]) (StateT InstanceContext m) Expr |
Check that the current set of type class dictionaries entail the specified type class goal, and, if so, return a type class dictionary reference.