constraints-emerge: 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.
[Skip to Readme]
Downloads
- constraints-emerge-0.1.2.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1, 0.1.1, 0.1.2 (info) |
|---|---|
| Change log | ChangeLog.md |
| Dependencies | base (>=4.9 && <5), constraints, containers, ghc (>=8.0.1), hashable [details] |
| Tested with | ghc ==8.0.1, ghc ==8.0.2, ghc ==8.2.2 |
| License | MIT |
| Copyright | 2018 Sandy Maguire |
| Author | Sandy Maguire |
| Maintainer | sandy@sandymaguire.me |
| Category | Constraints |
| Home page | https://github.com/isovector/constraints-emerge |
| Source repo | head: git clone git://github.com/isovector/constraints-emerge.git |
| Uploaded | by isovector at 2018-04-19T13:14:45Z |
| Distributions | |
| Reverse Dependencies | 1 direct, 0 indirect [details] |
| Downloads | 1563 total (6 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating | |
| Status | Docs available [build log] Last success reported on 2018-04-19 [all 1 reports] |