quantification-0.4: Rage against the quantification

Safe HaskellNone
LanguageHaskell2010

Data.Exists

Contents

Description

Data types and type classes for working with existentially quantified values. In the event that Quantified Class Constraints ever land in GHC, this package will be considered obsolete. The benefit that most of the typeclasses in this module provide is that they help populate the instances of Exists.

Synopsis

Data Types

data Exists (f :: k -> Type) Source #

Hide a type parameter.

Constructors

Exists !(f a) 
Instances
BoundedForall f => Bounded (Exists f) Source # 
Instance details

Defined in Data.Exists

Methods

minBound :: Exists f #

maxBound :: Exists f #

EnumForall f => Enum (Exists f) Source # 
Instance details

Defined in Data.Exists

Methods

succ :: Exists f -> Exists f #

pred :: Exists f -> Exists f #

toEnum :: Int -> Exists f #

fromEnum :: Exists f -> Int #

enumFrom :: Exists f -> [Exists f] #

enumFromThen :: Exists f -> Exists f -> [Exists f] #

enumFromTo :: Exists f -> Exists f -> [Exists f] #

enumFromThenTo :: Exists f -> Exists f -> Exists f -> [Exists f] #

EqForallPoly f => Eq (Exists f) Source # 
Instance details

Defined in Data.Exists

Methods

(==) :: Exists f -> Exists f -> Bool #

(/=) :: Exists f -> Exists f -> Bool #

OrdForallPoly f => Ord (Exists f) Source # 
Instance details

Defined in Data.Exists

Methods

compare :: Exists f -> Exists f -> Ordering #

(<) :: Exists f -> Exists f -> Bool #

(<=) :: Exists f -> Exists f -> Bool #

(>) :: Exists f -> Exists f -> Bool #

(>=) :: Exists f -> Exists f -> Bool #

max :: Exists f -> Exists f -> Exists f #

min :: Exists f -> Exists f -> Exists f #

ReadForall f => Read (Exists f) Source # 
Instance details

Defined in Data.Exists

ShowForall f => Show (Exists f) Source # 
Instance details

Defined in Data.Exists

Methods

showsPrec :: Int -> Exists f -> ShowS #

show :: Exists f -> String #

showList :: [Exists f] -> ShowS #

HashableForall f => Hashable (Exists f) Source # 
Instance details

Defined in Data.Exists

Methods

hashWithSalt :: Int -> Exists f -> Int #

hash :: Exists f -> Int #

ToJSONForall f => ToJSON (Exists f) Source # 
Instance details

Defined in Data.Exists

(ToJSONKeyForall f, ToJSONForall f) => ToJSONKey (Exists f) Source # 
Instance details

Defined in Data.Exists

FromJSONExists f => FromJSON (Exists f) Source # 
Instance details

Defined in Data.Exists

(FromJSONKeyExists f, FromJSONExists f) => FromJSONKey (Exists f) Source # 
Instance details

Defined in Data.Exists

PathPieceForall f => PathPiece (Exists f) Source # 
Instance details

Defined in Data.Exists

data Exists2 (f :: k -> j -> Type) Source #

Hide two type parameters.

Constructors

Exists2 !(f a b) 
Instances
EqForallPoly2 f => Eq (Exists2 f) Source # 
Instance details

Defined in Data.Exists

Methods

(==) :: Exists2 f -> Exists2 f -> Bool #

(/=) :: Exists2 f -> Exists2 f -> Bool #

ShowForall2 f => Show (Exists2 f) Source # 
Instance details

Defined in Data.Exists

Methods

showsPrec :: Int -> Exists2 f -> ShowS #

show :: Exists2 f -> String #

showList :: [Exists2 f] -> ShowS #

data Exists3 (f :: k -> j -> l -> Type) Source #

Hide three type parameters.

Constructors

Exists3 !(f a b c) 

data Some (f :: k -> Type) Source #

Constructors

Some !(Sing a) !(f a) 
Instances
(EqForall f, EqSing k) => Eq (Some f) Source # 
Instance details

Defined in Data.Exists

Methods

(==) :: Some f -> Some f -> Bool #

(/=) :: Some f -> Some f -> Bool #

(ToJSONForall f, ToJSONSing k) => ToJSON (Some f) Source # 
Instance details

Defined in Data.Exists

(FromJSONForall f, FromJSONSing k) => FromJSON (Some f) Source # 
Instance details

Defined in Data.Exists

data DependentPair (f :: k -> Type) (g :: k -> Type) Source #

Constructors

DependentPair (f a) (g a) 
Instances
(EqForallPoly f, ToSing f, EqForeach g) => Eq (DependentPair f g) Source # 
Instance details

Defined in Data.Exists

Methods

(==) :: DependentPair f g -> DependentPair f g -> Bool #

(/=) :: DependentPair f g -> DependentPair f g -> Bool #

(OrdForallPoly f, ToSing f, OrdForeach g) => Ord (DependentPair f g) Source # 
Instance details

Defined in Data.Exists

(ShowForall f, ToSing f, ShowForeach g) => Show (DependentPair f g) Source # 
Instance details

Defined in Data.Exists

Type Classes

class EqForall f where Source #

Minimal complete definition

eqForall

Methods

eqForall :: f a -> f a -> Bool Source #

Instances
EqForall (Proxy :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

eqForall :: Proxy a -> Proxy a -> Bool Source #

Eq a => EqForall (Const a :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

eqForall :: Const a a0 -> Const a a0 -> Bool Source #

EqForall ((:~:) a :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

eqForall :: (a :~: a0) -> (a :~: a0) -> Bool Source #

EqHetero h => EqForall (HFix h :: k -> *) Source # 
Instance details

Defined in Topaz.Types

Methods

eqForall :: HFix h a -> HFix h a -> Bool Source #

(EqForall f, EqForall g) => EqForall (Sum f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

eqForall :: Sum f g a -> Sum f g a -> Bool Source #

(EqForall f, EqForall g) => EqForall (Product f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

eqForall :: Product f g a -> Product f g a -> Bool Source #

(Eq1 f, EqForall g) => EqForall (Compose f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

eqForall :: Compose f g a -> Compose f g a -> Bool Source #

EqForall f => EqForall (Rec f :: [k] -> Type) Source # 
Instance details

Defined in Topaz.Types

Methods

eqForall :: Rec f a -> Rec f a -> Bool Source #

class EqForall f => EqForallPoly f where Source #

Methods

eqForallPoly :: f a -> f b -> WitnessedEquality a b Source #

eqForallPoly :: TestEquality f => f a -> f b -> WitnessedEquality a b Source #

Instances
(EqForallPoly f, EqForallPoly g) => EqForallPoly (Product f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

eqForallPoly :: Product f g a -> Product f g b -> WitnessedEquality a b Source #

class EqForeach f where Source #

Variant of EqForall that requires a pi-quantified type.

Minimal complete definition

eqForeach

Methods

eqForeach :: Sing a -> f a -> f a -> Bool Source #

class EqForall f => OrdForall f where Source #

Minimal complete definition

compareForall

Methods

compareForall :: f a -> f a -> Ordering Source #

Instances
OrdForall (Proxy :: k -> *) Source # 
Instance details

Defined in Data.Exists

Ord a => OrdForall (Const a :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

compareForall :: Const a a0 -> Const a a0 -> Ordering Source #

(OrdForall f, OrdForall g) => OrdForall (Sum f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

compareForall :: Sum f g a -> Sum f g a -> Ordering Source #

(OrdForall f, OrdForall g) => OrdForall (Product f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

compareForall :: Product f g a -> Product f g a -> Ordering Source #

OrdForall f => OrdForall (Rec f :: [k] -> Type) Source # 
Instance details

Defined in Topaz.Types

Methods

compareForall :: Rec f a -> Rec f a -> Ordering Source #

class (OrdForall f, EqForallPoly f) => OrdForallPoly f where Source #

Minimal complete definition

compareForallPoly

Methods

compareForallPoly :: f a -> f b -> WitnessedOrdering a b Source #

Instances
(OrdForallPoly f, OrdForallPoly g) => OrdForallPoly (Product f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

compareForallPoly :: Product f g a -> Product f g b -> WitnessedOrdering a b Source #

class EqForeach f => OrdForeach f where Source #

Variant of OrdForall that requires a pi-quantified type.

Minimal complete definition

compareForeach

Methods

compareForeach :: Sing a -> f a -> f a -> Ordering Source #

class ShowForall f where Source #

Minimal complete definition

showsPrecForall

Methods

showsPrecForall :: Int -> f a -> ShowS Source #

Instances
ShowForall (Proxy :: k -> *) Source # 
Instance details

Defined in Data.Exists

(ShowForall f, ShowForall g) => ShowForall (Product f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

showsPrecForall :: Int -> Product f g a -> ShowS Source #

(Show1 f, ShowForall g) => ShowForall (Compose f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

showsPrecForall :: Int -> Compose f g a -> ShowS Source #

ShowForall f => ShowForall (Rec f :: [k] -> Type) Source # 
Instance details

Defined in Topaz.Types

Methods

showsPrecForall :: Int -> Rec f a -> ShowS Source #

class ShowForeach f where Source #

Minimal complete definition

showsPrecForeach

Methods

showsPrecForeach :: Sing a -> Int -> f a -> ShowS Source #

class ReadForall f where Source #

Minimal complete definition

readPrecForall

Instances
ReadForall (Proxy :: k -> *) Source # 
Instance details

Defined in Data.Exists

class EnumForall f where Source #

Minimal complete definition

toEnumForall, fromEnumForall

class BoundedForall f where Source #

Minimal complete definition

minBoundForall, maxBoundForall

class SemigroupForall f where Source #

Minimal complete definition

sappendForall

Methods

sappendForall :: f a -> f a -> f a Source #

Instances
SemigroupForall (Proxy :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

sappendForall :: Proxy a -> Proxy a -> Proxy a Source #

SemigroupForall f => SemigroupForall (Rec f :: [k] -> Type) Source # 
Instance details

Defined in Topaz.Types

Methods

sappendForall :: Rec f a -> Rec f a -> Rec f a Source #

class SemigroupForall f => MonoidForall f where Source #

Minimal complete definition

memptyForall

Methods

memptyForall :: Sing a -> f a Source #

Instances
MonoidForall f => MonoidForall (Rec f :: [k] -> Type) Source # 
Instance details

Defined in Topaz.Types

Methods

memptyForall :: Sing a -> Rec f a Source #

class HashableForall f where Source #

Minimal complete definition

hashWithSaltForall

Methods

hashWithSaltForall :: Int -> f a -> Int Source #

Instances
Hashable a => HashableForall (Const a :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

hashWithSaltForall :: Int -> Const a a0 -> Int Source #

HashableForall f => HashableForall (Rec f :: [k] -> Type) Source # 
Instance details

Defined in Topaz.Types

Methods

hashWithSaltForall :: Int -> Rec f a -> Int Source #

class FromJSONForall f where Source #

Minimal complete definition

parseJSONForall

Methods

parseJSONForall :: Sing a -> Value -> Parser (f a) Source #

Instances
(FromJSON1 f, FromJSONForall g) => FromJSONForall (Compose f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

parseJSONForall :: Sing a -> Value -> Parser (Compose f g a) Source #

FromJSONForall f => FromJSONForall (Rec f :: [k] -> Type) Source # 
Instance details

Defined in Topaz.Types

Methods

parseJSONForall :: Sing a -> Value -> Parser (Rec f a) Source #

class FromJSONExists f where Source #

Minimal complete definition

parseJSONExists

Instances
FromJSONExists f => FromJSONExists (Rec f :: [k] -> Type) Source # 
Instance details

Defined in Topaz.Types

class ToJSONForall f where Source #

Minimal complete definition

toJSONForall

Methods

toJSONForall :: f a -> Value Source #

Instances
(ToJSON1 f, ToJSONForall g) => ToJSONForall (Compose f g :: k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

toJSONForall :: Compose f g a -> Value Source #

ToJSONForall f => ToJSONForall (Rec f :: [k] -> Type) Source # 
Instance details

Defined in Topaz.Types

Methods

toJSONForall :: Rec f a -> Value Source #

data ToJSONKeyFunctionForall f Source #

Constructors

ToJSONKeyTextForall !(forall a. f a -> Text) !(forall a. f a -> Encoding' Text) 
ToJSONKeyValueForall !(forall a. f a -> Value) !(forall a. f a -> Encoding) 

data FromJSONKeyFunctionForall f Source #

Constructors

FromJSONKeyTextParserForall !(forall a. Sing a -> Text -> Parser (f a)) 
FromJSONKeyValueForall !(forall a. Sing a -> Value -> Parser (f a)) 

class ToJSONKeyForall f where Source #

Minimal complete definition

toJSONKeyForall

class FromJSONKeyExists f where Source #

Minimal complete definition

fromJSONKeyExists

class StorableForall (f :: k -> Type) where Source #

Methods

peekForall :: Sing a -> Ptr (f a) -> IO (f a) Source #

pokeForall :: Ptr (f a) -> f a -> IO () Source #

sizeOfFunctorForall :: f a -> Int Source #

sizeOfForall :: forall (a :: k). Proxy f -> Sing a -> Int Source #

Instances
StorableForall f => StorableForall (Rec f :: [k] -> Type) Source # 
Instance details

Defined in Topaz.Types

Methods

peekForall :: Sing a -> Ptr (Rec f a) -> IO (Rec f a) Source #

pokeForall :: Ptr (Rec f a) -> Rec f a -> IO () Source #

sizeOfFunctorForall :: Rec f a -> Int Source #

sizeOfForall :: Proxy (Rec f) -> Sing a -> Int Source #

Higher Rank Classes

class EqForall2 f where Source #

Minimal complete definition

eqForall2

Methods

eqForall2 :: f a b -> f a b -> Bool Source #

Instances
EqForall2 ((:~:) :: k -> k -> *) Source # 
Instance details

Defined in Data.Exists

Methods

eqForall2 :: (a :~: b) -> (a :~: b) -> Bool Source #

class EqForallPoly2 f where Source #

Minimal complete definition

eqForallPoly2

Methods

eqForallPoly2 :: f a b -> f c d -> Bool Source #

class ShowForall2 f where Source #

Minimal complete definition

showsPrecForall2

Methods

showsPrecForall2 :: Int -> f a b -> ShowS Source #

More Type Classes

type family Sing = (r :: k -> Type) | r -> k Source #

Instances
type Sing Source # 
Instance details

Defined in Topaz.Types

type Sing = SingNat
type Sing Source # 
Instance details

Defined in Data.Exists

type Sing = (SingList :: [k] -> Type)
type Sing Source # 
Instance details

Defined in Data.Exists

type Sing = (SingMaybe :: Maybe k -> Type)

data SingList :: [k] -> Type where Source #

Constructors

SingListNil :: SingList '[] 
SingListCons :: Sing r -> SingList rs -> SingList (r ': rs) 

data SingMaybe :: Maybe k -> Type where Source #

class Reify a where Source #

Minimal complete definition

reify

Methods

reify :: Sing a Source #

Instances
Reify ([] :: [k]) Source # 
Instance details

Defined in Data.Exists

Methods

reify :: Sing [] Source #

Reify (Nothing :: Maybe a) Source # 
Instance details

Defined in Data.Exists

Reify a2 => Reify (Just a2 :: Maybe a1) Source # 
Instance details

Defined in Data.Exists

Methods

reify :: Sing (Just a2) Source #

(Reify a2, Reify as) => Reify (a2 ': as :: [a1]) Source # 
Instance details

Defined in Data.Exists

Methods

reify :: Sing (a2 ': as) Source #

class Unreify k where Source #

Minimal complete definition

unreify

Methods

unreify :: forall (a :: k) b. Sing a -> (Reify a => b) -> b Source #

Instances
Unreify k => Unreify [k] Source # 
Instance details

Defined in Data.Exists

Methods

unreify :: Sing a -> (Reify a -> b) -> b Source #

Sing Type Classes

class EqSing k where Source #

Minimal complete definition

eqSing

Methods

eqSing :: forall (a :: k) (b :: k). Sing a -> Sing b -> Maybe (a :~: b) Source #

Instances
EqSing a => EqSing [a] Source # 
Instance details

Defined in Data.Exists

Methods

eqSing :: Sing a0 -> Sing b -> Maybe (a0 :~: b) Source #

class ToJSONSing k where Source #

Minimal complete definition

toJSONSing

Methods

toJSONSing :: forall (a :: k). Sing a -> Value Source #

class FromJSONSing k where Source #

Minimal complete definition

parseJSONSing

Methods

parseJSONSing :: Value -> Parser (Exists (Sing :: k -> Type)) Source #

class ToSing (f :: k -> Type) where Source #

Minimal complete definition

toSing

Methods

toSing :: f a -> Sing a Source #

Functions

Show

Defaulting

parseJSONMapForallKey :: forall f a v. (FromJSONKeyForall f, OrdForall f) => (Value -> Parser v) -> Sing a -> Value -> Parser (Map (f a) v) Source #

Parse a Map whose key type is higher-kinded. This only creates a valid Map if the OrdForall instance agrees with the Ord instance.

Weakening

Other

unreifyList :: forall (as :: [k]) b. Unreify k => SingList as -> (Reify as => b) -> b Source #