barbies-2.0.4.0: Classes for working with types that can change clothes.
Safe Haskell None
Language Haskell2010

Barbies.Constraints

Description

Support for operating on Barbie-types with constrained functions.

Synopsis

Instance dictionaries

data Dict c a where Source #

Dict c a is evidence that there exists an instance of c a .

It is essentially equivalent to Dict (c a) from the constraints package, but because of its kind, it allows us to define things like Dict Show .

Constructors

Dict :: c a => Dict c a

requiringDict :: (c a => r) -> Dict c a -> r Source #

Turn a constrained-function into an unconstrained one that uses the packed instance dictionary instead.

Getting constraints

type AllBF c f b = AllB ( ClassF c f) b Source #

Similar to AllB but will put the functor argument f between the constraint c and the type a . For example:

  AllB  Show   Person ~ (Show    String,  Show    Int)
  AllBF Show f Person ~ (Show (f String), Show (f Int))
  

class c (f a) => ClassF c f a Source #

ClassF has one universal instance that makes ClassF c f a equivalent to c (f a) . However, we have

'ClassF c f :: k -> Constraint

This is useful since it allows to define constraint-constructors like ClassF Monoid Maybe

Instances

Instances details
c (f a) => ClassF (c :: k1 -> Constraint ) (f :: k2 -> k1) (a :: k2) Source #
Instance details

Defined in Barbies.Internal.Dicts

class c (f a) (g a) => ClassFG c f g a Source #

Like ClassF but for binary relations.

Instances

Instances details
c (f a) (g a) => ClassFG (c :: k1 -> k2 -> Constraint ) (f :: k3 -> k1) (g :: k3 -> k2) (a :: k3) Source #
Instance details

Defined in Barbies.Internal.Dicts