Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 Exists (f :: k -> Type) = Exists !(f a)
- data Exists2 (f :: k -> j -> Type) = Exists2 !(f a b)
- data Exists3 (f :: k -> j -> l -> Type) = Exists3 !(f a b c)
- data Some (f :: k -> Type) = Some !(Sing a) !(f a)
- data DependentPair (f :: k -> Type) (g :: k -> Type) = DependentPair (f a) (g a)
- data WitnessedEquality (a :: k) (b :: k) where
- data WitnessedOrdering (a :: k) (b :: k) where
- class EqForall f where
- class EqForall f => EqForallPoly f where
- class EqForeach f where
- class EqForall f => OrdForall f where
- class (OrdForall f, EqForallPoly f) => OrdForallPoly f where
- class EqForeach f => OrdForeach f where
- class ShowForall f where
- class ShowForeach f where
- class ReadForall f where
- class EnumForall f where
- class BoundedForall f where
- class SemigroupForall f where
- class SemigroupForall f => MonoidForall f where
- class HashableForall f where
- class PathPieceForall f where
- class FromJSONForall f where
- class FromJSONExists f where
- class ToJSONForall f where
- data ToJSONKeyFunctionForall f
- = 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
- = FromJSONKeyTextParserForall !(forall a. Sing a -> Text -> Parser (f a))
- | FromJSONKeyValueForall !(forall a. Sing a -> Value -> Parser (f a))
- class ToJSONKeyForall f where
- class FromJSONKeyExists f where
- class FromJSONKeyForall f where
- class StorableForall (f :: k -> Type) where
- class EqForall2 f where
- class EqForallPoly2 f where
- class ShowForall2 f where
- type family Sing = (r :: k -> Type) | r -> k
- data SingList :: [k] -> Type where
- SingListNil :: SingList '[]
- SingListCons :: Sing r -> SingList rs -> SingList (r ': rs)
- data SingMaybe :: Maybe k -> Type where
- SingMaybeJust :: Sing a -> SingMaybe (Just a)
- SingMaybeNothing :: SingMaybe Nothing
- class Reify a where
- class Unreify k where
- class EqSing k where
- class ToJSONSing k where
- class FromJSONSing k where
- class ToSing (f :: k -> Type) where
- showsForall :: ShowForall f => f a -> ShowS
- showForall :: ShowForall f => f a -> String
- showsForall2 :: ShowForall2 f => f a b -> ShowS
- showForall2 :: ShowForall2 f => f a b -> String
- defaultEqForallPoly :: (TestEquality f, EqForall f) => f a -> f b -> WitnessedEquality a b
- defaultCompareForallPoly :: (TestEquality f, OrdForall f) => f a -> f b -> Ordering
- parseJSONMapForallKey :: forall f a v. (FromJSONKeyForall f, OrdForall f) => (Value -> Parser v) -> Sing a -> Value -> Parser (Map (f a) v)
- weakenEquality :: WitnessedEquality a b -> Bool
- weakenOrdering :: WitnessedOrdering a b -> Ordering
- unreifyList :: forall (as :: [k]) b. Unreify k => SingList as -> (Reify as => b) -> b
Data Types
data Exists (f :: k -> Type) Source #
Hide a type parameter.
Exists !(f a) |
Instances
BoundedForall f => Bounded (Exists f) Source # | |
EnumForall f => Enum (Exists f) Source # | |
EqForallPoly f => Eq (Exists f) Source # | |
OrdForallPoly f => Ord (Exists f) Source # | |
Defined in Data.Exists | |
ReadForall f => Read (Exists f) Source # | |
ShowForall f => Show (Exists f) Source # | |
HashableForall f => Hashable (Exists f) Source # | |
Defined in Data.Exists | |
ToJSONForall f => ToJSON (Exists f) Source # | |
Defined in Data.Exists | |
(ToJSONKeyForall f, ToJSONForall f) => ToJSONKey (Exists f) Source # | |
Defined in Data.Exists toJSONKey :: ToJSONKeyFunction (Exists f) # toJSONKeyList :: ToJSONKeyFunction [Exists f] # | |
FromJSONExists f => FromJSON (Exists f) Source # | |
(FromJSONKeyExists f, FromJSONExists f) => FromJSONKey (Exists f) Source # | |
Defined in Data.Exists fromJSONKey :: FromJSONKeyFunction (Exists f) # | |
PathPieceForall f => PathPiece (Exists f) Source # | |
Defined in Data.Exists fromPathPiece :: Text -> Maybe (Exists f) # toPathPiece :: Exists f -> Text # |
data Exists2 (f :: k -> j -> Type) Source #
Hide two type parameters.
Exists2 !(f a b) |
Instances
EqForallPoly2 f => Eq (Exists2 f) Source # | |
ShowForall2 f => Show (Exists2 f) Source # | |
data Some (f :: k -> Type) Source #
Instances
(EqForall f, EqSing k) => Eq (Some f) Source # | |
(ToJSONForall f, ToJSONSing k) => ToJSON (Some f) Source # | |
Defined in Data.Exists | |
(FromJSONForall f, FromJSONSing k) => FromJSON (Some f) Source # | |
data DependentPair (f :: k -> Type) (g :: k -> Type) Source #
DependentPair (f a) (g a) |
Instances
(EqForallPoly f, ToSing f, EqForeach g) => Eq (DependentPair f g) Source # | |
Defined in Data.Exists (==) :: 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 # | |
Defined in Data.Exists compare :: DependentPair f g -> DependentPair f g -> Ordering # (<) :: DependentPair f g -> DependentPair f g -> Bool # (<=) :: DependentPair f g -> DependentPair f g -> Bool # (>) :: DependentPair f g -> DependentPair f g -> Bool # (>=) :: DependentPair f g -> DependentPair f g -> Bool # max :: DependentPair f g -> DependentPair f g -> DependentPair f g # min :: DependentPair f g -> DependentPair f g -> DependentPair f g # | |
(ShowForall f, ToSing f, ShowForeach g) => Show (DependentPair f g) Source # | |
Defined in Data.Exists showsPrec :: Int -> DependentPair f g -> ShowS # show :: DependentPair f g -> String # showList :: [DependentPair f g] -> ShowS # |
data WitnessedEquality (a :: k) (b :: k) where Source #
data WitnessedOrdering (a :: k) (b :: k) where Source #
Type Classes
class EqForall f where Source #
Instances
EqForall (Proxy :: k -> *) Source # | |
Eq a => EqForall (Const a :: k -> *) Source # | |
EqForall ((:~:) a :: k -> *) Source # | |
EqHetero h => EqForall (HFix h :: k -> *) Source # | |
(EqForall f, EqForall g) => EqForall (Sum f g :: k -> *) Source # | |
(EqForall f, EqForall g) => EqForall (Product f g :: k -> *) Source # | |
(Eq1 f, EqForall g) => EqForall (Compose f g :: k -> *) Source # | |
EqForall f => EqForall (Rec f :: [k] -> Type) Source # | |
class EqForall f => EqForallPoly f where Source #
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 # | |
Defined in Data.Exists eqForallPoly :: Product f g a -> Product f g b -> WitnessedEquality a b Source # |
class EqForall f => OrdForall f where Source #
compareForall :: f a -> f a -> Ordering Source #
Instances
OrdForall (Proxy :: k -> *) Source # | |
Defined in Data.Exists | |
Ord a => OrdForall (Const a :: k -> *) Source # | |
Defined in Data.Exists | |
(OrdForall f, OrdForall g) => OrdForall (Sum f g :: k -> *) Source # | |
Defined in Data.Exists | |
(OrdForall f, OrdForall g) => OrdForall (Product f g :: k -> *) Source # | |
Defined in Data.Exists | |
OrdForall f => OrdForall (Rec f :: [k] -> Type) Source # | |
Defined in Topaz.Types |
class (OrdForall f, EqForallPoly f) => OrdForallPoly f where Source #
compareForallPoly :: f a -> f b -> WitnessedOrdering a b Source #
Instances
(OrdForallPoly f, OrdForallPoly g) => OrdForallPoly (Product f g :: k -> *) Source # | |
Defined in Data.Exists 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.
compareForeach :: Sing a -> f a -> f a -> Ordering Source #
class ShowForall f where Source #
showsPrecForall :: Int -> f a -> ShowS Source #
Instances
ShowForall (Proxy :: k -> *) Source # | |
Defined in Data.Exists | |
(ShowForall f, ShowForall g) => ShowForall (Product f g :: k -> *) Source # | |
Defined in Data.Exists | |
(Show1 f, ShowForall g) => ShowForall (Compose f g :: k -> *) Source # | |
Defined in Data.Exists | |
ShowForall f => ShowForall (Rec f :: [k] -> Type) Source # | |
Defined in Topaz.Types |
class ShowForeach f where Source #
class ReadForall f where Source #
readPrecForall :: ReadPrec (Exists f) Source #
Instances
ReadForall (Proxy :: k -> *) Source # | |
Defined in Data.Exists |
class EnumForall f where Source #
toEnumForall :: Int -> Exists f Source #
fromEnumForall :: f a -> Int Source #
class BoundedForall f where Source #
minBoundForall :: Exists f Source #
maxBoundForall :: Exists f Source #
class SemigroupForall f where Source #
sappendForall :: f a -> f a -> f a Source #
Instances
SemigroupForall (Proxy :: k -> *) Source # | |
Defined in Data.Exists | |
SemigroupForall f => SemigroupForall (Rec f :: [k] -> Type) Source # | |
Defined in Topaz.Types |
class SemigroupForall f => MonoidForall f where Source #
memptyForall :: Sing a -> f a Source #
Instances
MonoidForall f => MonoidForall (Rec f :: [k] -> Type) Source # | |
Defined in Topaz.Types memptyForall :: Sing a -> Rec f a Source # |
class HashableForall f where Source #
hashWithSaltForall :: Int -> f a -> Int Source #
Instances
Hashable a => HashableForall (Const a :: k -> *) Source # | |
Defined in Data.Exists | |
HashableForall f => HashableForall (Rec f :: [k] -> Type) Source # | |
Defined in Topaz.Types |
class PathPieceForall f where Source #
fromPathPieceForall :: Text -> Maybe (Exists f) Source #
toPathPieceForall :: f a -> Text Source #
class FromJSONForall f where Source #
Instances
(FromJSON1 f, FromJSONForall g) => FromJSONForall (Compose f g :: k -> *) Source # | |
Defined in Data.Exists | |
FromJSONForall f => FromJSONForall (Rec f :: [k] -> Type) Source # | |
Defined in Topaz.Types |
class FromJSONExists f where Source #
Instances
FromJSONExists f => FromJSONExists (Rec f :: [k] -> Type) Source # | |
Defined in Topaz.Types |
class ToJSONForall f where Source #
toJSONForall :: f a -> Value Source #
Instances
(ToJSON1 f, ToJSONForall g) => ToJSONForall (Compose f g :: k -> *) Source # | |
Defined in Data.Exists toJSONForall :: Compose f g a -> Value Source # | |
ToJSONForall f => ToJSONForall (Rec f :: [k] -> Type) Source # | |
Defined in Topaz.Types toJSONForall :: Rec f a -> Value Source # |
data ToJSONKeyFunctionForall f Source #
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 #
FromJSONKeyTextParserForall !(forall a. Sing a -> Text -> Parser (f a)) | |
FromJSONKeyValueForall !(forall a. Sing a -> Value -> Parser (f a)) |
class ToJSONKeyForall f where Source #
class FromJSONKeyExists f where Source #
class FromJSONKeyForall f where Source #
class StorableForall (f :: k -> Type) where Source #
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 # | |
Higher Rank Classes
class ShowForall2 f where Source #
showsPrecForall2 :: Int -> f a b -> ShowS Source #
More Type Classes
data SingList :: [k] -> Type where Source #
SingListNil :: SingList '[] | |
SingListCons :: Sing r -> SingList rs -> SingList (r ': rs) |
data SingMaybe :: Maybe k -> Type where Source #
SingMaybeJust :: Sing a -> SingMaybe (Just a) | |
SingMaybeNothing :: SingMaybe Nothing |
Sing Type Classes
class FromJSONSing k where Source #
Functions
Show
showsForall :: ShowForall f => f a -> ShowS Source #
showForall :: ShowForall f => f a -> String Source #
showsForall2 :: ShowForall2 f => f a b -> ShowS Source #
showForall2 :: ShowForall2 f => f a b -> String Source #
Defaulting
defaultEqForallPoly :: (TestEquality f, EqForall f) => f a -> f b -> WitnessedEquality a b Source #
defaultCompareForallPoly :: (TestEquality f, OrdForall f) => f a -> f b -> Ordering Source #
parseJSONMapForallKey :: forall f a v. (FromJSONKeyForall f, OrdForall f) => (Value -> Parser v) -> Sing a -> Value -> Parser (Map (f a) v) Source #
Weakening
weakenEquality :: WitnessedEquality a b -> Bool Source #
weakenOrdering :: WitnessedOrdering a b -> Ordering Source #