constraints-0.8: Constraint manipulation

Copyright(C) 2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

Data.Constraint.Deferrable

Description

The idea for this trick comes from Dimitrios Vytiniotis.

Synopsis

Documentation

class Deferrable p where Source #

Allow an attempt at resolution of a constraint at a later time

Minimal complete definition

deferEither

Methods

deferEither :: proxy p -> (p => r) -> Either String r Source #

Resolve a Deferrable constraint with observable failure.

Instances

(Deferrable a, Deferrable b) => Deferrable (a, b) Source # 

Methods

deferEither :: proxy (a, b) -> ((a, b) -> r) -> Either String r Source #

(Typeable * a, Typeable * b) => Deferrable ((~) * a b) Source # 

Methods

deferEither :: proxy ((* ~ a) b) -> ((* ~ a) b -> r) -> Either String r Source #

(Deferrable a, Deferrable b, Deferrable c) => Deferrable (a, b, c) Source # 

Methods

deferEither :: proxy (a, b, c) -> ((a, b, c) -> r) -> Either String r Source #

defer :: forall proxy p r. Deferrable p => proxy p -> (p => r) -> r Source #

Defer a constraint for later resolution in a context where we want to upgrade failure into an error

deferred :: forall p. Deferrable p :- p Source #