@hackage constraints-emerge0.1.2

Defer instance lookups until runtime

This plugin allows you to write

{-# OPTIONS_GHC -fplugin Data.Constraint.Emerge.Plugin #-}
module Test where

import Data.Constraint.Emerge

showAnything :: forall c. Emerge (Show c) => c -> String
showAnything c =
case emerge @(Show c) of
Just Dict -> show c
Nothing   -> "{{unshowable}}"

where the 'Emerge (Show c)' will automatically be discharged for any monomorphic c.

See test/EmergeSpec.hs for a few examples of what this plugin can do for you.