unsatisfiable-0: Unsatisfiable type class

Unsatisfiable.Plugin

Description

A type-checker plugin for Unsatisfiable type class.

Synopsis

# Documentation

{-# OPTIONS_GHC -fplugin=Unsatisfiable #-}


This plugin does two things:

Firstly, when there is wanted Unsatisfiable constraint, we pretty-pring its message. Unfortunately the actual No instance for (Unsatisfiable msg) error is also printed, as we don't solve it, except when -fdefer-type-errors is enabled. In that case unsatisfiable will throw an error with the rendered message.

Secondly, when Unsatisfiable constraint is given, all other constraints are solved automatically using unsatisfiable as the evidence. This is useful

class C a => D a
instance Unsatisfiable Msg => D Int  -- Note absence of C Int in the context


The motivation here is that if we use Unsatisfiable to ban an instance with a nice error message, we don't want to get extra error messages arising from failure to solve the superclass constraints, which we get if we are obliged to use

instance (Unsatisfiable Msg, C Int) => D Int


When GHC looks for valid type hole fits this plugin might print some errors. You may disable them with -fno-show-valid-hole-fits ghc option.