purescript-0.13.0: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.TypeChecker.Entailment

Description

Type class entailment

Synopsis

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

Constructors

SolverOptions 

Fields

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.

entails Source #

Arguments

:: (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.