{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExplicitNamespaces #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
#if __GLASGOW_HASKELL__ >= 806
{-# LANGUAGE QuantifiedConstraints #-}
#else
{-# LANGUAGE TypeInType #-}
#endif
#if __GLASGOW_HASKELL__ >= 810
{-# LANGUAGE StandaloneKindSignatures #-}
#endif
module Data.Singletons (
Sing, SLambda(..), (@@),
SingI(..),
SingI1(..), sing1,
SingI2(..), sing2,
SingKind(..),
KindOf, SameKind,
SingInstance(..), SomeSing(..),
singInstance, pattern Sing, withSingI,
withSomeSing, pattern FromSing,
usingSingI1, usingSingI2,
singByProxy, singByProxy1, singByProxy2,
demote, demote1, demote2,
singByProxy#, singByProxy1#, singByProxy2#,
withSing, withSing1, withSing2,
singThat, singThat1, singThat2,
WrappedSing(..), SWrappedSing(..), UnwrapSing,
TyFun, type (~>),
TyCon1, TyCon2, TyCon3, TyCon4, TyCon5, TyCon6, TyCon7, TyCon8,
Apply, type (@@),
#if __GLASGOW_HASKELL__ >= 806
TyCon, ApplyTyCon, ApplyTyConAux1, ApplyTyConAux2,
#endif
singFun1, singFun2, singFun3, singFun4, singFun5, singFun6, singFun7,
singFun8,
unSingFun1, unSingFun2, unSingFun3, unSingFun4, unSingFun5,
unSingFun6, unSingFun7, unSingFun8,
pattern SLambda2, applySing2,
pattern SLambda3, applySing3,
pattern SLambda4, applySing4,
pattern SLambda5, applySing5,
pattern SLambda6, applySing6,
pattern SLambda7, applySing7,
pattern SLambda8, applySing8,
SingFunction1, SingFunction2, SingFunction3, SingFunction4, SingFunction5,
SingFunction6, SingFunction7, SingFunction8,
Proxy(..),
DemoteSym0, DemoteSym1,
SameKindSym0, SameKindSym1, SameKindSym2,
KindOfSym0, KindOfSym1,
type (~>@#@$), type (~>@#@$$), type (~>@#@$$$),
ApplySym0, ApplySym1, ApplySym2,
type (@@@#@$), type (@@@#@$$), type (@@@#@$$$)
) where
import Data.Kind (Constraint, Type)
import Data.Proxy (Proxy(..))
import GHC.Exts (Proxy#)
import Unsafe.Coerce (unsafeCoerce)
#if __GLASGOW_HASKELL__ >= 810
type KindOf :: k -> Type
#endif
type KindOf (a :: k) = k
#if __GLASGOW_HASKELL__ >= 810
type SameKind :: k -> k -> Constraint
#endif
type SameKind (a :: k) (b :: k) = (() :: Constraint)
#if __GLASGOW_HASKELL__ >= 810
type Sing :: k -> Type
#endif
type family Sing :: k -> Type
#if __GLASGOW_HASKELL__ >= 900
type SingI :: forall {k}. k -> Constraint
#endif
class SingI a where
sing :: Sing a
#if __GLASGOW_HASKELL__ >= 900
type SingI1 :: forall {k1} {k2}. (k1 -> k2) -> Constraint
#endif
class
#if __GLASGOW_HASKELL__ >= 806
(forall x. SingI x => SingI (f x)) =>
#endif
SingI1 f where
liftSing :: Sing x -> Sing (f x)
sing1 :: (SingI1 f, SingI x) => Sing (f x)
sing1 :: Sing (f x)
sing1 = Sing x -> Sing (f x)
forall k k (f :: k -> k) (x :: k). SingI1 f => Sing x -> Sing (f x)
liftSing Sing x
forall k (a :: k). SingI a => Sing a
sing
#if __GLASGOW_HASKELL__ >= 900
type SingI2 :: forall {k1} {k2} {k3}. (k1 -> k2 -> k3) -> Constraint
#endif
class
#if __GLASGOW_HASKELL__ >= 806
(forall x y. (SingI x, SingI y) => SingI (f x y)) =>
#endif
SingI2 f where
liftSing2 :: Sing x -> Sing y -> Sing (f x y)
sing2 :: (SingI2 f, SingI x, SingI y) => Sing (f x y)
sing2 :: Sing (f x y)
sing2 = Sing x -> Sing y -> Sing (f x y)
forall k k k (f :: k -> k -> k) (x :: k) (y :: k).
SingI2 f =>
Sing x -> Sing y -> Sing (f x y)
liftSing2 Sing x
forall k (a :: k). SingI a => Sing a
sing Sing y
forall k (a :: k). SingI a => Sing a
sing
#if __GLASGOW_HASKELL__ >= 802
{-# COMPLETE Sing #-}
#endif
pattern Sing :: forall k (a :: k). () => SingI a => Sing a
pattern $bSing :: Sing a
$mSing :: forall r k (a :: k). Sing a -> (SingI a => r) -> (Void# -> r) -> r
Sing <- (singInstance -> SingInstance)
where Sing = Sing a
forall k (a :: k). SingI a => Sing a
sing
#if __GLASGOW_HASKELL__ >= 810
type SingKind :: Type -> Constraint
#endif
class SingKind k where
type Demote k = (r :: Type) | r -> k
fromSing :: Sing (a :: k) -> Demote k
toSing :: Demote k -> SomeSing k
#if __GLASGOW_HASKELL__ >= 810
type SomeSing :: Type -> Type
#endif
data SomeSing k where
SomeSing :: Sing (a :: k) -> SomeSing k
#if __GLASGOW_HASKELL__ >= 802
{-# COMPLETE FromSing #-}
#endif
pattern FromSing :: SingKind k => forall (a :: k). Sing a -> Demote k
pattern $bFromSing :: Sing a -> Demote k
$mFromSing :: forall r k.
SingKind k =>
Demote k -> (forall (a :: k). Sing a -> r) -> (Void# -> r) -> r
FromSing sng <- ((\demotedVal -> withSomeSing demotedVal SomeSing) -> SomeSing sng)
where FromSing Sing a
sng = Sing a -> Demote k
forall k (a :: k). SingKind k => Sing a -> Demote k
fromSing Sing a
sng
#if __GLASGOW_HASKELL__ >= 810
type WrappedSing :: k -> Type
#endif
newtype WrappedSing :: forall k. k -> Type where
WrapSing :: forall k (a :: k). { WrappedSing a -> Sing a
unwrapSing :: Sing a } -> WrappedSing a
#if __GLASGOW_HASKELL__ >= 810
type SWrappedSing :: forall k (a :: k). WrappedSing a -> Type
#endif
newtype SWrappedSing :: forall k (a :: k). WrappedSing a -> Type where
SWrapSing :: forall k (a :: k) (ws :: WrappedSing a).
{ SWrappedSing ws -> Sing a
sUnwrapSing :: Sing a } -> SWrappedSing ws
type instance Sing = SWrappedSing
#if __GLASGOW_HASKELL__ >= 810
type UnwrapSing :: forall k (a :: k). WrappedSing a -> Sing a
#endif
type family UnwrapSing (ws :: WrappedSing (a :: k)) :: Sing a where
UnwrapSing ('WrapSing s) = s
instance SingKind (WrappedSing a) where
type Demote (WrappedSing a) = WrappedSing a
fromSing :: Sing a -> Demote (WrappedSing a)
fromSing (SWrapSing s) = Sing a -> WrappedSing a
forall k (a :: k). Sing a -> WrappedSing a
WrapSing Sing a
s
toSing :: Demote (WrappedSing a) -> SomeSing (WrappedSing a)
toSing (WrapSing s) = Sing Any -> SomeSing (WrappedSing a)
forall k (a :: k). Sing a -> SomeSing k
SomeSing (Sing Any -> SomeSing (WrappedSing a))
-> Sing Any -> SomeSing (WrappedSing a)
forall a b. (a -> b) -> a -> b
$ Sing a -> SWrappedSing Any
forall k (a :: k) (ws :: WrappedSing a). Sing a -> SWrappedSing ws
SWrapSing Sing a
s
instance forall a (s :: Sing a). SingI a => SingI ('WrapSing s) where
sing :: Sing ('WrapSing s)
sing = Sing a -> SWrappedSing ('WrapSing s)
forall k (a :: k) (ws :: WrappedSing a). Sing a -> SWrappedSing ws
SWrapSing Sing a
forall k (a :: k). SingI a => Sing a
sing
#if __GLASGOW_HASKELL__ >= 810
type SingInstance :: k -> Type
#endif
data SingInstance (a :: k) where
SingInstance :: SingI a => SingInstance a
#if __GLASGOW_HASKELL__ >= 810
type DI :: k -> Type
#endif
newtype DI a = Don'tInstantiate (SingI a => SingInstance a)
singInstance :: forall k (a :: k). Sing a -> SingInstance a
singInstance :: Sing a -> SingInstance a
singInstance Sing a
s = (SingI a => SingInstance a) -> SingInstance a
with_sing_i SingI a => SingInstance a
forall k (a :: k). SingI a => SingInstance a
SingInstance
where
with_sing_i :: (SingI a => SingInstance a) -> SingInstance a
with_sing_i :: (SingI a => SingInstance a) -> SingInstance a
with_sing_i SingI a => SingInstance a
si = DI a -> Sing a -> SingInstance a
forall a b. a -> b
unsafeCoerce ((SingI a => SingInstance a) -> DI a
forall k (a :: k). (SingI a => SingInstance a) -> DI a
Don'tInstantiate SingI a => SingInstance a
si) Sing a
s
#if __GLASGOW_HASKELL__ >= 810
type TyFun :: Type -> Type -> Type
#endif
data TyFun :: Type -> Type -> Type
#if __GLASGOW_HASKELL__ >= 810
type (~>) :: Type -> Type -> Type
#endif
type a ~> b = TyFun a b -> Type
infixr 0 ~>
#if __GLASGOW_HASKELL__ >= 810
type Apply :: (k1 ~> k2) -> k1 -> k2
#endif
type family Apply (f :: k1 ~> k2) (x :: k1) :: k2
#if __GLASGOW_HASKELL__ >= 810
type (@@) :: (k1 ~> k2) -> k1 -> k2
#endif
type a @@ b = Apply a b
infixl 9 @@
#if __GLASGOW_HASKELL__ >= 806
#if __GLASGOW_HASKELL__ >= 810
type TyCon :: (k1 -> k2) -> unmatchable_fun
#endif
data family TyCon :: (k1 -> k2) -> unmatchable_fun
#if __GLASGOW_HASKELL__ >= 810
type ApplyTyCon :: (k1 -> k2) -> (k1 ~> unmatchable_fun)
#endif
type family ApplyTyCon :: (k1 -> k2) -> (k1 ~> unmatchable_fun) where
#if __GLASGOW_HASKELL__ >= 808
ApplyTyCon @k1 @(k2 -> k3) @unmatchable_fun = ApplyTyConAux2
ApplyTyCon @k1 @k2 @k2 = ApplyTyConAux1
#else
ApplyTyCon = (ApplyTyConAux2 :: (k1 -> k2 -> k3) -> (k1 ~> unmatchable_fun))
ApplyTyCon = (ApplyTyConAux1 :: (k1 -> k2) -> (k1 ~> k2))
#endif
type instance Apply (TyCon f) x = ApplyTyCon f @@ x
#if __GLASGOW_HASKELL__ >= 810
type ApplyTyConAux1 :: (k1 -> k2) -> (k1 ~> k2)
#endif
data ApplyTyConAux1 :: (k1 -> k2) -> (k1 ~> k2)
#if __GLASGOW_HASKELL__ >= 810
type ApplyTyConAux2 :: (k1 -> k2 -> k3) -> (k1 ~> unmatchable_fun)
#endif
data ApplyTyConAux2 :: (k1 -> k2 -> k3) -> (k1 ~> unmatchable_fun)
type instance Apply (ApplyTyConAux1 f) x = f x
type instance Apply (ApplyTyConAux2 f) x = TyCon (f x)
#if __GLASGOW_HASKELL__ >= 810
type TyCon1 :: (k1 -> k2) -> (k1 ~> k2)
type TyCon2 :: (k1 -> k2 -> k3) -> (k1 ~> k2 ~> k3)
type TyCon3 :: (k1 -> k2 -> k3 -> k4) -> (k1 ~> k2 ~> k3 ~> k4)
type TyCon4 :: (k1 -> k2 -> k3 -> k4 -> k5) -> (k1 ~> k2 ~> k3 ~> k4 ~> k5)
type TyCon5 :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6)
type TyCon6 :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7)
type TyCon7 :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> k8)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7 ~> k8)
type TyCon8 :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> k8 -> k9)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7 ~> k8 ~> k9)
#endif
type TyCon1 = (TyCon :: (k1 -> k2) -> (k1 ~> k2))
type TyCon2 = (TyCon :: (k1 -> k2 -> k3) -> (k1 ~> k2 ~> k3))
type TyCon3 = (TyCon :: (k1 -> k2 -> k3 -> k4) -> (k1 ~> k2 ~> k3 ~> k4))
type TyCon4 = (TyCon :: (k1 -> k2 -> k3 -> k4 -> k5) -> (k1 ~> k2 ~> k3 ~> k4 ~> k5))
type TyCon5 = (TyCon :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6))
type TyCon6 = (TyCon :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7))
type TyCon7 = (TyCon :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> k8)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7 ~> k8))
type TyCon8 = (TyCon :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> k8 -> k9)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7 ~> k8 ~> k9))
#else
data TyCon1 :: (k1 -> k2) -> (k1 ~> k2)
data TyCon2 :: (k1 -> k2 -> k3) -> (k1 ~> k2 ~> k3)
data TyCon3 :: (k1 -> k2 -> k3 -> k4) -> (k1 ~> k2 ~> k3 ~> k4)
data TyCon4 :: (k1 -> k2 -> k3 -> k4 -> k5) -> (k1 ~> k2 ~> k3 ~> k4 ~> k5)
data TyCon5 :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6)
data TyCon6 :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7)
data TyCon7 :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> k8)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7 ~> k8)
data TyCon8 :: (k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> k8 -> k9)
-> (k1 ~> k2 ~> k3 ~> k4 ~> k5 ~> k6 ~> k7 ~> k8 ~> k9)
type instance Apply (TyCon1 f) x = f x
type instance Apply (TyCon2 f) x = TyCon1 (f x)
type instance Apply (TyCon3 f) x = TyCon2 (f x)
type instance Apply (TyCon4 f) x = TyCon3 (f x)
type instance Apply (TyCon5 f) x = TyCon4 (f x)
type instance Apply (TyCon6 f) x = TyCon5 (f x)
type instance Apply (TyCon7 f) x = TyCon6 (f x)
type instance Apply (TyCon8 f) x = TyCon7 (f x)
#endif
#if __GLASGOW_HASKELL__ >= 810
type SLambda :: (k1 ~> k2) -> Type
#endif
newtype SLambda (f :: k1 ~> k2) =
SLambda { SLambda f -> forall (t :: k1). Sing t -> Sing (f @@ t)
applySing :: forall t. Sing t -> Sing (f @@ t) }
type instance Sing = SLambda
(@@) :: forall k1 k2 (f :: k1 ~> k2) (t :: k1). Sing f -> Sing t -> Sing (f @@ t)
@@ :: Sing f -> Sing t -> Sing (f @@ t)
(@@) Sing f
f = SLambda f -> forall (t :: k1). Sing t -> Sing (f @@ t)
forall k1 k2 (f :: k1 ~> k2).
SLambda f -> forall (t :: k1). Sing t -> Sing (f @@ t)
applySing SLambda f
Sing f
f
instance (SingKind k1, SingKind k2) => SingKind (k1 ~> k2) where
type Demote (k1 ~> k2) = Demote k1 -> Demote k2
fromSing :: Sing a -> Demote (k1 ~> k2)
fromSing Sing a
sFun Demote k1
x = Demote k1 -> (forall (a :: k1). Sing a -> Demote k2) -> Demote k2
forall k r.
SingKind k =>
Demote k -> (forall (a :: k). Sing a -> r) -> r
withSomeSing Demote k1
x (Sing (Apply a a) -> Demote k2
forall k (a :: k). SingKind k => Sing a -> Demote k
fromSing (Sing (Apply a a) -> Demote k2)
-> (Sing a -> Sing (Apply a a)) -> Sing a -> Demote k2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SLambda a -> forall (t :: k1). Sing t -> Sing (a @@ t)
forall k1 k2 (f :: k1 ~> k2).
SLambda f -> forall (t :: k1). Sing t -> Sing (f @@ t)
applySing SLambda a
Sing a
sFun)
toSing :: Demote (k1 ~> k2) -> SomeSing (k1 ~> k2)
toSing Demote (k1 ~> k2)
f = Sing Any -> SomeSing (k1 ~> k2)
forall k (a :: k). Sing a -> SomeSing k
SomeSing Sing Any
forall (f :: k1 ~> k2). Sing f
slam
where
slam :: forall (f :: k1 ~> k2). Sing f
slam :: Sing f
slam = SingFunction1 f -> Sing f
forall a1 b (f :: a1 ~> b). SingFunction1 f -> Sing f
singFun1 @f SingFunction1 f
lam
where
lam :: forall (t :: k1). Sing t -> Sing (f @@ t)
lam :: Sing t -> Sing (f @@ t)
lam Sing t
x = Demote k2
-> (forall (a :: k2). Sing a -> Sing (f @@ t)) -> Sing (f @@ t)
forall k r.
SingKind k =>
Demote k -> (forall (a :: k). Sing a -> r) -> r
withSomeSing (Demote (k1 ~> k2)
Demote k1 -> Demote k2
f (Sing t -> Demote k1
forall k (a :: k). SingKind k => Sing a -> Demote k
fromSing Sing t
x)) (\(r :: Sing res) -> Sing a -> Sing (f @@ t)
forall a b. a -> b
unsafeCoerce Sing a
r)
#if __GLASGOW_HASKELL__ >= 810
type SingFunction1 :: (a1 ~> b) -> Type
type SingFunction2 :: (a1 ~> a2 ~> b) -> Type
type SingFunction3 :: (a1 ~> a2 ~> a3 ~> b) -> Type
type SingFunction4 :: (a1 ~> a2 ~> a3 ~> a4 ~> b) -> Type
type SingFunction5 :: (a1 ~> a2 ~> a3 ~> a4 ~> a5 ~> b) -> Type
type SingFunction6 :: (a1 ~> a2 ~> a3 ~> a4 ~> a5 ~> a6 ~> b) -> Type
type SingFunction7 :: (a1 ~> a2 ~> a3 ~> a4 ~> a5 ~> a6 ~> a7 ~> b) -> Type
type SingFunction8 :: (a1 ~> a2 ~> a3 ~> a4 ~> a5 ~> a6 ~> a7 ~> a8 ~> b) -> Type
#endif
type SingFunction1 (f :: a1 ~> b) =
forall t. Sing t -> Sing (f @@ t)
singFun1 :: forall f. SingFunction1 f -> Sing f
singFun1 :: SingFunction1 f -> Sing f
singFun1 SingFunction1 f
f = SingFunction1 f -> SLambda f
forall k1 k2 (f :: k1 ~> k2).
(forall (t :: k1). Sing t -> Sing (f @@ t)) -> SLambda f
SLambda SingFunction1 f
f
type SingFunction2 (f :: a1 ~> a2 ~> b) =
forall t1 t2. Sing t1 -> Sing t2 -> Sing (f @@ t1 @@ t2)
singFun2 :: forall f. SingFunction2 f -> Sing f
singFun2 :: SingFunction2 f -> Sing f
singFun2 SingFunction2 f
f = (forall (t :: a1). Sing t -> Sing (f @@ t)) -> SLambda f
forall k1 k2 (f :: k1 ~> k2).
(forall (t :: k1). Sing t -> Sing (f @@ t)) -> SLambda f
SLambda (\Sing t
x -> SingFunction1 (f @@ t) -> Sing (f @@ t)
forall a1 b (f :: a1 ~> b). SingFunction1 f -> Sing f
singFun1 (Sing t -> Sing t -> Sing ((f @@ t) @@ t)
SingFunction2 f
f Sing t
x))
type SingFunction3 (f :: a1 ~> a2 ~> a3 ~> b) =
forall t1 t2 t3.
Sing t1 -> Sing t2 -> Sing t3
-> Sing (f @@ t1 @@ t2 @@ t3)
singFun3 :: forall f. SingFunction3 f -> Sing f
singFun3 :: SingFunction3 f -> Sing f
singFun3 SingFunction3 f
f = (forall (t :: a1). Sing t -> Sing (f @@ t)) -> SLambda f
forall k1 k2 (f :: k1 ~> k2).
(forall (t :: k1). Sing t -> Sing (f @@ t)) -> SLambda f
SLambda (\Sing t
x -> SingFunction2 (f @@ t) -> Sing (f @@ t)
forall a1 a2 b (f :: a1 ~> (a2 ~> b)). SingFunction2 f -> Sing f
singFun2 (Sing t -> Sing t1 -> Sing t2 -> Sing (((f @@ t) @@ t1) @@ t2)
SingFunction3 f
f Sing t
x))
type SingFunction4 (f :: a1 ~> a2 ~> a3 ~> a4 ~> b) =
forall t1 t2 t3 t4.
Sing t1 -> Sing t2 -> Sing t3 -> Sing t4
-> Sing (f @@ t1 @@ t2 @@ t3 @@ t4)
singFun4 :: forall f. SingFunction4 f -> Sing f
singFun4 :: SingFunction4 f -> Sing f
singFun4 SingFunction4 f
f = (forall (t :: a1). Sing t -> Sing (f @@ t)) -> SLambda f
forall k1 k2 (f :: k1 ~> k2).
(forall (t :: k1). Sing t -> Sing (f @@ t)) -> SLambda f
SLambda (\Sing t
x -> SingFunction3 (f @@ t) -> Sing (f @@ t)
forall a1 a2 a3 b (f :: a1 ~> (a2 ~> (a3 ~> b))).
SingFunction3 f -> Sing f
singFun3 (Sing t
-> Sing t1
-> Sing t2
-> Sing t3
-> Sing ((((f @@ t) @@ t1) @@ t2) @@ t3)
SingFunction4 f
f Sing t
x))
type SingFunction5 (f :: a1 ~> a2 ~> a3 ~> a4 ~> a5 ~> b) =
forall t1 t2 t3 t4 t5.
Sing t1 -> Sing t2 -> Sing t3 -> Sing t4 -> Sing t5
-> Sing (f @@ t1 @@ t2 @@ t3 @@ t4 @@ t5)
singFun5 :: forall f. SingFunction5 f -> Sing f
singFun5 :: SingFunction5 f -> Sing f
singFun5 SingFunction5 f
f = (forall (t :: a1). Sing t -> Sing (f @@ t)) -> SLambda f
forall k1 k2 (f :: k1 ~> k2).
(forall (t :: k1). Sing t -> Sing (f @@ t)) -> SLambda f
SLambda (\Sing t
x -> SingFunction4 (f @@ t) -> Sing (f @@ t)
forall a1 a2 a3 a4 b (f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> b)))).
SingFunction4 f -> Sing f
singFun4 (Sing t
-> Sing t1
-> Sing t2
-> Sing t3
-> Sing t4
-> Sing (((((f @@ t) @@ t1) @@ t2) @@ t3) @@ t4)
SingFunction5 f
f Sing t
x))
type SingFunction6 (f :: a1 ~> a2 ~> a3 ~> a4 ~> a5 ~> a6 ~> b) =
forall t1 t2 t3 t4 t5 t6.
Sing t1 -> Sing t2 -> Sing t3 -> Sing t4 -> Sing t5 -> Sing t6
-> Sing (f @@ t1 @@ t2 @@ t3 @@ t4 @@ t5 @@ t6)
singFun6 :: forall f. SingFunction6 f -> Sing f
singFun6 :: SingFunction6 f -> Sing f
singFun6 SingFunction6 f
f = (forall (t :: a1). Sing t -> Sing (f @@ t)) -> SLambda f
forall k1 k2 (f :: k1 ~> k2).
(forall (t :: k1). Sing t -> Sing (f @@ t)) -> SLambda f
SLambda (\Sing t
x -> SingFunction5 (f @@ t) -> Sing (f @@ t)
forall a1 a2 a3 a4 a5 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> b))))).
SingFunction5 f -> Sing f
singFun5 (Sing t
-> Sing t1
-> Sing t2
-> Sing t3
-> Sing t4
-> Sing t5
-> Sing ((((((f @@ t) @@ t1) @@ t2) @@ t3) @@ t4) @@ t5)
SingFunction6 f
f Sing t
x))
type SingFunction7 (f :: a1 ~> a2 ~> a3 ~> a4 ~> a5 ~> a6 ~> a7 ~> b) =
forall t1 t2 t3 t4 t5 t6 t7.
Sing t1 -> Sing t2 -> Sing t3 -> Sing t4 -> Sing t5 -> Sing t6 -> Sing t7
-> Sing (f @@ t1 @@ t2 @@ t3 @@ t4 @@ t5 @@ t6 @@ t7)
singFun7 :: forall f. SingFunction7 f -> Sing f
singFun7 :: SingFunction7 f -> Sing f
singFun7 SingFunction7 f
f = (forall (t :: a1). Sing t -> Sing (f @@ t)) -> SLambda f
forall k1 k2 (f :: k1 ~> k2).
(forall (t :: k1). Sing t -> Sing (f @@ t)) -> SLambda f
SLambda (\Sing t
x -> SingFunction6 (f @@ t) -> Sing (f @@ t)
forall a1 a2 a3 a4 a5 a6 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> (a6 ~> b)))))).
SingFunction6 f -> Sing f
singFun6 (Sing t
-> Sing t1
-> Sing t2
-> Sing t3
-> Sing t4
-> Sing t5
-> Sing t6
-> Sing (((((((f @@ t) @@ t1) @@ t2) @@ t3) @@ t4) @@ t5) @@ t6)
SingFunction7 f
f Sing t
x))
type SingFunction8 (f :: a1 ~> a2 ~> a3 ~> a4 ~> a5 ~> a6 ~> a7 ~> a8 ~> b) =
forall t1 t2 t3 t4 t5 t6 t7 t8.
Sing t1 -> Sing t2 -> Sing t3 -> Sing t4 -> Sing t5 -> Sing t6 -> Sing t7 -> Sing t8
-> Sing (f @@ t1 @@ t2 @@ t3 @@ t4 @@ t5 @@ t6 @@ t7 @@ t8)
singFun8 :: forall f. SingFunction8 f -> Sing f
singFun8 :: SingFunction8 f -> Sing f
singFun8 SingFunction8 f
f = (forall (t :: a1). Sing t -> Sing (f @@ t)) -> SLambda f
forall k1 k2 (f :: k1 ~> k2).
(forall (t :: k1). Sing t -> Sing (f @@ t)) -> SLambda f
SLambda (\Sing t
x -> SingFunction7 (f @@ t) -> Sing (f @@ t)
forall a1 a2 a3 a4 a5 a6 a7 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> (a6 ~> (a7 ~> b))))))).
SingFunction7 f -> Sing f
singFun7 (Sing t
-> Sing t1
-> Sing t2
-> Sing t3
-> Sing t4
-> Sing t5
-> Sing t6
-> Sing t7
-> Sing
((((((((f @@ t) @@ t1) @@ t2) @@ t3) @@ t4) @@ t5) @@ t6) @@ t7)
SingFunction8 f
f Sing t
x))
unSingFun1 :: forall f. Sing f -> SingFunction1 f
unSingFun1 :: Sing f -> SingFunction1 f
unSingFun1 Sing f
sf = SLambda f -> SingFunction1 f
forall k1 k2 (f :: k1 ~> k2).
SLambda f -> forall (t :: k1). Sing t -> Sing (f @@ t)
applySing SLambda f
Sing f
sf
unSingFun2 :: forall f. Sing f -> SingFunction2 f
unSingFun2 :: Sing f -> SingFunction2 f
unSingFun2 Sing f
sf Sing t1
x = Sing (Apply f t1) -> SingFunction1 (Apply f t1)
forall a1 b (f :: a1 ~> b). Sing f -> SingFunction1 f
unSingFun1 (Sing f
sf Sing f -> Sing t1 -> Sing (Apply f t1)
forall k1 k2 (f :: k1 ~> k2) (t :: k1).
Sing f -> Sing t -> Sing (f @@ t)
@@ Sing t1
x)
unSingFun3 :: forall f. Sing f -> SingFunction3 f
unSingFun3 :: Sing f -> SingFunction3 f
unSingFun3 Sing f
sf Sing t1
x = Sing (Apply f t1) -> SingFunction2 (Apply f t1)
forall a1 a2 b (f :: a1 ~> (a2 ~> b)). Sing f -> SingFunction2 f
unSingFun2 (Sing f
sf Sing f -> Sing t1 -> Sing (Apply f t1)
forall k1 k2 (f :: k1 ~> k2) (t :: k1).
Sing f -> Sing t -> Sing (f @@ t)
@@ Sing t1
x)
unSingFun4 :: forall f. Sing f -> SingFunction4 f
unSingFun4 :: Sing f -> SingFunction4 f
unSingFun4 Sing f
sf Sing t1
x = Sing (Apply f t1) -> SingFunction3 (Apply f t1)
forall a1 a2 a3 b (f :: a1 ~> (a2 ~> (a3 ~> b))).
Sing f -> SingFunction3 f
unSingFun3 (Sing f
sf Sing f -> Sing t1 -> Sing (Apply f t1)
forall k1 k2 (f :: k1 ~> k2) (t :: k1).
Sing f -> Sing t -> Sing (f @@ t)
@@ Sing t1
x)
unSingFun5 :: forall f. Sing f -> SingFunction5 f
unSingFun5 :: Sing f -> SingFunction5 f
unSingFun5 Sing f
sf Sing t1
x = Sing (Apply f t1) -> SingFunction4 (Apply f t1)
forall a1 a2 a3 a4 b (f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> b)))).
Sing f -> SingFunction4 f
unSingFun4 (Sing f
sf Sing f -> Sing t1 -> Sing (Apply f t1)
forall k1 k2 (f :: k1 ~> k2) (t :: k1).
Sing f -> Sing t -> Sing (f @@ t)
@@ Sing t1
x)
unSingFun6 :: forall f. Sing f -> SingFunction6 f
unSingFun6 :: Sing f -> SingFunction6 f
unSingFun6 Sing f
sf Sing t1
x = Sing (Apply f t1) -> SingFunction5 (Apply f t1)
forall a1 a2 a3 a4 a5 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> b))))).
Sing f -> SingFunction5 f
unSingFun5 (Sing f
sf Sing f -> Sing t1 -> Sing (Apply f t1)
forall k1 k2 (f :: k1 ~> k2) (t :: k1).
Sing f -> Sing t -> Sing (f @@ t)
@@ Sing t1
x)
unSingFun7 :: forall f. Sing f -> SingFunction7 f
unSingFun7 :: Sing f -> SingFunction7 f
unSingFun7 Sing f
sf Sing t1
x = Sing (Apply f t1) -> SingFunction6 (Apply f t1)
forall a1 a2 a3 a4 a5 a6 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> (a6 ~> b)))))).
Sing f -> SingFunction6 f
unSingFun6 (Sing f
sf Sing f -> Sing t1 -> Sing (Apply f t1)
forall k1 k2 (f :: k1 ~> k2) (t :: k1).
Sing f -> Sing t -> Sing (f @@ t)
@@ Sing t1
x)
unSingFun8 :: forall f. Sing f -> SingFunction8 f
unSingFun8 :: Sing f -> SingFunction8 f
unSingFun8 Sing f
sf Sing t1
x = Sing (Apply f t1) -> SingFunction7 (Apply f t1)
forall a1 a2 a3 a4 a5 a6 a7 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> (a6 ~> (a7 ~> b))))))).
Sing f -> SingFunction7 f
unSingFun7 (Sing f
sf Sing f -> Sing t1 -> Sing (Apply f t1)
forall k1 k2 (f :: k1 ~> k2) (t :: k1).
Sing f -> Sing t -> Sing (f @@ t)
@@ Sing t1
x)
#if __GLASGOW_HASKELL__ >= 802
{-# COMPLETE SLambda2 #-}
{-# COMPLETE SLambda3 #-}
{-# COMPLETE SLambda4 #-}
{-# COMPLETE SLambda5 #-}
{-# COMPLETE SLambda6 #-}
{-# COMPLETE SLambda7 #-}
{-# COMPLETE SLambda8 #-}
#endif
pattern SLambda2 :: forall f. SingFunction2 f -> Sing f
pattern $bSLambda2 :: SingFunction2 f -> Sing f
$mSLambda2 :: forall r a1 a2 b (f :: a1 ~> (a2 ~> b)).
Sing f -> (SingFunction2 f -> r) -> (Void# -> r) -> r
SLambda2 {Sing f
-> forall (t1 :: a1) (t2 :: a2).
Sing t1 -> Sing t2 -> Sing ((f @@ t1) @@ t2)
applySing2} <- (unSingFun2 -> applySing2)
where SLambda2 SingFunction2 f
lam2 = SingFunction2 f -> Sing f
forall a1 a2 b (f :: a1 ~> (a2 ~> b)). SingFunction2 f -> Sing f
singFun2 SingFunction2 f
lam2
pattern SLambda3 :: forall f. SingFunction3 f -> Sing f
pattern $bSLambda3 :: SingFunction3 f -> Sing f
$mSLambda3 :: forall r a1 a2 a3 b (f :: a1 ~> (a2 ~> (a3 ~> b))).
Sing f -> (SingFunction3 f -> r) -> (Void# -> r) -> r
SLambda3 {Sing f
-> forall (t1 :: a1) (t2 :: a2) (t3 :: a3).
Sing t1 -> Sing t2 -> Sing t3 -> Sing (((f @@ t1) @@ t2) @@ t3)
applySing3} <- (unSingFun3 -> applySing3)
where SLambda3 SingFunction3 f
lam3 = SingFunction3 f -> Sing f
forall a1 a2 a3 b (f :: a1 ~> (a2 ~> (a3 ~> b))).
SingFunction3 f -> Sing f
singFun3 SingFunction3 f
lam3
pattern SLambda4 :: forall f. SingFunction4 f -> Sing f
pattern $bSLambda4 :: SingFunction4 f -> Sing f
$mSLambda4 :: forall r a1 a2 a3 a4 b (f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> b)))).
Sing f -> (SingFunction4 f -> r) -> (Void# -> r) -> r
SLambda4 {Sing f
-> forall (t1 :: a1) (t2 :: a2) (t3 :: a3) (t4 :: a4).
Sing t1
-> Sing t2
-> Sing t3
-> Sing t4
-> Sing ((((f @@ t1) @@ t2) @@ t3) @@ t4)
applySing4} <- (unSingFun4 -> applySing4)
where SLambda4 SingFunction4 f
lam4 = SingFunction4 f -> Sing f
forall a1 a2 a3 a4 b (f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> b)))).
SingFunction4 f -> Sing f
singFun4 SingFunction4 f
lam4
pattern SLambda5 :: forall f. SingFunction5 f -> Sing f
pattern $bSLambda5 :: SingFunction5 f -> Sing f
$mSLambda5 :: forall r a1 a2 a3 a4 a5 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> b))))).
Sing f -> (SingFunction5 f -> r) -> (Void# -> r) -> r
SLambda5 {Sing f
-> forall (t1 :: a1) (t2 :: a2) (t3 :: a3) (t4 :: a4) (t5 :: a5).
Sing t1
-> Sing t2
-> Sing t3
-> Sing t4
-> Sing t5
-> Sing (((((f @@ t1) @@ t2) @@ t3) @@ t4) @@ t5)
applySing5} <- (unSingFun5 -> applySing5)
where SLambda5 SingFunction5 f
lam5 = SingFunction5 f -> Sing f
forall a1 a2 a3 a4 a5 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> b))))).
SingFunction5 f -> Sing f
singFun5 SingFunction5 f
lam5
pattern SLambda6 :: forall f. SingFunction6 f -> Sing f
pattern $bSLambda6 :: SingFunction6 f -> Sing f
$mSLambda6 :: forall r a1 a2 a3 a4 a5 a6 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> (a6 ~> b)))))).
Sing f -> (SingFunction6 f -> r) -> (Void# -> r) -> r
SLambda6 {Sing f
-> forall (t1 :: a1) (t2 :: a2) (t3 :: a3) (t4 :: a4) (t5 :: a5)
(t6 :: a6).
Sing t1
-> Sing t2
-> Sing t3
-> Sing t4
-> Sing t5
-> Sing t6
-> Sing ((((((f @@ t1) @@ t2) @@ t3) @@ t4) @@ t5) @@ t6)
applySing6} <- (unSingFun6 -> applySing6)
where SLambda6 SingFunction6 f
lam6 = SingFunction6 f -> Sing f
forall a1 a2 a3 a4 a5 a6 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> (a6 ~> b)))))).
SingFunction6 f -> Sing f
singFun6 SingFunction6 f
lam6
pattern SLambda7 :: forall f. SingFunction7 f -> Sing f
pattern $bSLambda7 :: SingFunction7 f -> Sing f
$mSLambda7 :: forall r a1 a2 a3 a4 a5 a6 a7 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> (a6 ~> (a7 ~> b))))))).
Sing f -> (SingFunction7 f -> r) -> (Void# -> r) -> r
SLambda7 {Sing f
-> forall (t1 :: a1) (t2 :: a2) (t3 :: a3) (t4 :: a4) (t5 :: a5)
(t6 :: a6) (t7 :: a7).
Sing t1
-> Sing t2
-> Sing t3
-> Sing t4
-> Sing t5
-> Sing t6
-> Sing t7
-> Sing (((((((f @@ t1) @@ t2) @@ t3) @@ t4) @@ t5) @@ t6) @@ t7)
applySing7} <- (unSingFun7 -> applySing7)
where SLambda7 SingFunction7 f
lam7 = SingFunction7 f -> Sing f
forall a1 a2 a3 a4 a5 a6 a7 b
(f :: a1 ~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> (a6 ~> (a7 ~> b))))))).
SingFunction7 f -> Sing f
singFun7 SingFunction7 f
lam7
pattern SLambda8 :: forall f. SingFunction8 f -> Sing f
pattern $bSLambda8 :: SingFunction8 f -> Sing f
$mSLambda8 :: forall r a1 a2 a3 a4 a5 a6 a7 a8 b
(f :: a1
~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> (a6 ~> (a7 ~> (a8 ~> b)))))))).
Sing f -> (SingFunction8 f -> r) -> (Void# -> r) -> r
SLambda8 {Sing f
-> forall (t1 :: a1) (t2 :: a2) (t3 :: a3) (t4 :: a4) (t5 :: a5)
(t6 :: a6) (t7 :: a7) (t8 :: a8).
Sing t1
-> Sing t2
-> Sing t3
-> Sing t4
-> Sing t5
-> Sing t6
-> Sing t7
-> Sing t8
-> Sing
((((((((f @@ t1) @@ t2) @@ t3) @@ t4) @@ t5) @@ t6) @@ t7) @@ t8)
applySing8} <- (unSingFun8 -> applySing8)
where SLambda8 SingFunction8 f
lam8 = SingFunction8 f -> Sing f
forall a1 a2 a3 a4 a5 a6 a7 a8 b
(f :: a1
~> (a2 ~> (a3 ~> (a4 ~> (a5 ~> (a6 ~> (a7 ~> (a8 ~> b)))))))).
SingFunction8 f -> Sing f
singFun8 SingFunction8 f
lam8
withSingI :: Sing n -> (SingI n => r) -> r
withSingI :: Sing n -> (SingI n => r) -> r
withSingI Sing n
sn SingI n => r
r =
case Sing n -> SingInstance n
forall k (a :: k). Sing a -> SingInstance a
singInstance Sing n
sn of
SingInstance n
SingInstance -> r
SingI n => r
r
withSomeSing :: forall k r
. SingKind k
=> Demote k
-> (forall (a :: k). Sing a -> r)
-> r
withSomeSing :: Demote k -> (forall (a :: k). Sing a -> r) -> r
withSomeSing Demote k
x forall (a :: k). Sing a -> r
f =
case Demote k -> SomeSing k
forall k. SingKind k => Demote k -> SomeSing k
toSing Demote k
x of
SomeSing Sing a
x' -> Sing a -> r
forall (a :: k). Sing a -> r
f Sing a
x'
usingSingI1 :: forall f x r. (SingI1 f, SingI x) => (SingI (f x) => r) -> r
usingSingI1 :: (SingI (f x) => r) -> r
usingSingI1 SingI (f x) => r
k = Sing (f x) -> (SingI (f x) => r) -> r
forall k (n :: k) r. Sing n -> (SingI n => r) -> r
withSingI ((SingI1 f, SingI x) => Sing (f x)
forall k k (f :: k -> k) (x :: k).
(SingI1 f, SingI x) =>
Sing (f x)
sing1 @f @x) SingI (f x) => r
k
usingSingI2 :: forall f x y r. (SingI2 f, SingI x, SingI y) => (SingI (f x y) => r) -> r
usingSingI2 :: (SingI (f x y) => r) -> r
usingSingI2 SingI (f x y) => r
k = Sing (f x y) -> (SingI (f x y) => r) -> r
forall k (n :: k) r. Sing n -> (SingI n => r) -> r
withSingI ((SingI2 f, SingI x, SingI y) => Sing (f x y)
forall k k k (f :: k -> k -> k) (x :: k) (y :: k).
(SingI2 f, SingI x, SingI y) =>
Sing (f x y)
sing2 @f @x @y) SingI (f x y) => r
k
withSing :: SingI a => (Sing a -> b) -> b
withSing :: (Sing a -> b) -> b
withSing Sing a -> b
f = Sing a -> b
f Sing a
forall k (a :: k). SingI a => Sing a
sing
withSing1 :: (SingI1 f, SingI x) => (Sing (f x) -> b) -> b
withSing1 :: (Sing (f x) -> b) -> b
withSing1 Sing (f x) -> b
f = Sing (f x) -> b
f Sing (f x)
forall k k (f :: k -> k) (x :: k).
(SingI1 f, SingI x) =>
Sing (f x)
sing1
withSing2 :: (SingI2 f, SingI x, SingI y) => (Sing (f x y) -> b) -> b
withSing2 :: (Sing (f x y) -> b) -> b
withSing2 Sing (f x y) -> b
f = Sing (f x y) -> b
f Sing (f x y)
forall k k k (f :: k -> k -> k) (x :: k) (y :: k).
(SingI2 f, SingI x, SingI y) =>
Sing (f x y)
sing2
singThat :: forall k (a :: k). (SingKind k, SingI a)
=> (Demote k -> Bool) -> Maybe (Sing a)
singThat :: (Demote k -> Bool) -> Maybe (Sing a)
singThat Demote k -> Bool
p = (Sing a -> Maybe (Sing a)) -> Maybe (Sing a)
forall k (a :: k) b. SingI a => (Sing a -> b) -> b
withSing ((Sing a -> Maybe (Sing a)) -> Maybe (Sing a))
-> (Sing a -> Maybe (Sing a)) -> Maybe (Sing a)
forall a b. (a -> b) -> a -> b
$ \Sing a
x -> if Demote k -> Bool
p (Sing a -> Demote k
forall k (a :: k). SingKind k => Sing a -> Demote k
fromSing Sing a
x) then Sing a -> Maybe (Sing a)
forall a. a -> Maybe a
Just Sing a
x else Maybe (Sing a)
forall a. Maybe a
Nothing
singThat1 :: forall k1 k2 (f :: k1 -> k2) (x :: k1).
(SingKind k2, SingI1 f, SingI x)
=> (Demote k2 -> Bool) -> Maybe (Sing (f x))
singThat1 :: (Demote k2 -> Bool) -> Maybe (Sing (f x))
singThat1 Demote k2 -> Bool
p = (Sing (f x) -> Maybe (Sing (f x))) -> Maybe (Sing (f x))
forall k k (f :: k -> k) (x :: k) b.
(SingI1 f, SingI x) =>
(Sing (f x) -> b) -> b
withSing1 ((Sing (f x) -> Maybe (Sing (f x))) -> Maybe (Sing (f x)))
-> (Sing (f x) -> Maybe (Sing (f x))) -> Maybe (Sing (f x))
forall a b. (a -> b) -> a -> b
$ \Sing (f x)
x -> if Demote k2 -> Bool
p (Sing (f x) -> Demote k2
forall k (a :: k). SingKind k => Sing a -> Demote k
fromSing Sing (f x)
x) then Sing (f x) -> Maybe (Sing (f x))
forall a. a -> Maybe a
Just Sing (f x)
x else Maybe (Sing (f x))
forall a. Maybe a
Nothing
singThat2 :: forall k1 k2 k3 (f :: k1 -> k2 -> k3) (x :: k1) (y :: k2).
(SingKind k3, SingI2 f, SingI x, SingI y)
=> (Demote k3 -> Bool) -> Maybe (Sing (f x y))
singThat2 :: (Demote k3 -> Bool) -> Maybe (Sing (f x y))
singThat2 Demote k3 -> Bool
p = (Sing (f x y) -> Maybe (Sing (f x y))) -> Maybe (Sing (f x y))
forall k k k (f :: k -> k -> k) (x :: k) (y :: k) b.
(SingI2 f, SingI x, SingI y) =>
(Sing (f x y) -> b) -> b
withSing2 ((Sing (f x y) -> Maybe (Sing (f x y))) -> Maybe (Sing (f x y)))
-> (Sing (f x y) -> Maybe (Sing (f x y))) -> Maybe (Sing (f x y))
forall a b. (a -> b) -> a -> b
$ \Sing (f x y)
x -> if Demote k3 -> Bool
p (Sing (f x y) -> Demote k3
forall k (a :: k). SingKind k => Sing a -> Demote k
fromSing Sing (f x y)
x) then Sing (f x y) -> Maybe (Sing (f x y))
forall a. a -> Maybe a
Just Sing (f x y)
x else Maybe (Sing (f x y))
forall a. Maybe a
Nothing
singByProxy :: SingI a => proxy a -> Sing a
singByProxy :: proxy a -> Sing a
singByProxy proxy a
_ = Sing a
forall k (a :: k). SingI a => Sing a
sing
singByProxy1 :: (SingI1 f, SingI x) => proxy (f x) -> Sing (f x)
singByProxy1 :: proxy (f x) -> Sing (f x)
singByProxy1 proxy (f x)
_ = Sing (f x)
forall k k (f :: k -> k) (x :: k).
(SingI1 f, SingI x) =>
Sing (f x)
sing1
singByProxy2 :: (SingI2 f, SingI x, SingI y) => proxy (f x y) -> Sing (f x y)
singByProxy2 :: proxy (f x y) -> Sing (f x y)
singByProxy2 proxy (f x y)
_ = Sing (f x y)
forall k k k (f :: k -> k -> k) (x :: k) (y :: k).
(SingI2 f, SingI x, SingI y) =>
Sing (f x y)
sing2
singByProxy# :: SingI a => Proxy# a -> Sing a
singByProxy# :: Proxy# a -> Sing a
singByProxy# Proxy# a
_ = Sing a
forall k (a :: k). SingI a => Sing a
sing
singByProxy1# :: (SingI1 f, SingI x) => Proxy# (f x) -> Sing (f x)
singByProxy1# :: Proxy# (f x) -> Sing (f x)
singByProxy1# Proxy# (f x)
_ = Sing (f x)
forall k k (f :: k -> k) (x :: k).
(SingI1 f, SingI x) =>
Sing (f x)
sing1
singByProxy2# :: (SingI2 f, SingI x, SingI y) => Proxy# (f x y) -> Sing (f x y)
singByProxy2# :: Proxy# (f x y) -> Sing (f x y)
singByProxy2# Proxy# (f x y)
_ = Sing (f x y)
forall k k k (f :: k -> k -> k) (x :: k) (y :: k).
(SingI2 f, SingI x, SingI y) =>
Sing (f x y)
sing2
demote ::
#if __GLASGOW_HASKELL__ >= 900
forall {k} (a :: k). (SingKind k, SingI a) => Demote k
#else
forall a. (SingKind (KindOf a), SingI a) => Demote (KindOf a)
#endif
demote :: Demote (KindOf a)
demote = Sing a -> Demote (KindOf a)
forall k (a :: k). SingKind k => Sing a -> Demote k
fromSing (SingI a => Sing a
forall k (a :: k). SingI a => Sing a
sing @a)
demote1 ::
#if __GLASGOW_HASKELL__ >= 900
forall {k1} {k2} (f :: k1 -> k2) (x :: k1).
(SingKind k2, SingI1 f, SingI x) =>
Demote k2
#else
forall f x.
(SingKind (KindOf (f x)), SingI1 f, SingI x) =>
Demote (KindOf (f x))
#endif
demote1 :: Demote (KindOf (f x))
demote1 = Sing (f x) -> Demote (KindOf (f x))
forall k (a :: k). SingKind k => Sing a -> Demote k
fromSing ((SingI1 f, SingI x) => Sing (f x)
forall k k (f :: k -> k) (x :: k).
(SingI1 f, SingI x) =>
Sing (f x)
sing1 @f @x)
demote2 ::
#if __GLASGOW_HASKELL__ >= 900
forall {k1} {k2} {k3} (f :: k1 -> k2 -> k3) (x :: k1) (y :: k2).
(SingKind k3, SingI2 f, SingI x, SingI y) =>
Demote k3
#else
forall f x y.
(SingKind (KindOf (f x y)), SingI2 f, SingI x, SingI y) =>
Demote (KindOf (f x y))
#endif
demote2 :: Demote (KindOf (f x y))
demote2 = Sing (f x y) -> Demote (KindOf (f x y))
forall k (a :: k). SingKind k => Sing a -> Demote k
fromSing ((SingI2 f, SingI x, SingI y) => Sing (f x y)
forall k k k (f :: k -> k -> k) (x :: k) (y :: k).
(SingI2 f, SingI x, SingI y) =>
Sing (f x y)
sing2 @f @x @y)
#if __GLASGOW_HASKELL__ >= 806
instance forall k1 kr (f :: k1 -> kr).
( forall a. SingI a => SingI (f a)
, (ApplyTyCon :: (k1 -> kr) -> (k1 ~> kr))
~ ApplyTyConAux1
) => SingI (TyCon1 f) where
sing :: Sing (TyCon1 f)
sing = SingFunction1 (TyCon1 f) -> Sing (TyCon1 f)
forall a1 b (f :: a1 ~> b). SingFunction1 f -> Sing f
singFun1 (Sing t -> (SingI t => Sing (f t)) -> Sing (f t)
forall k (n :: k) r. Sing n -> (SingI n => r) -> r
`withSingI` SingI t => Sing (f t)
forall k (a :: k). SingI a => Sing a
sing)
instance forall k1 k2 kr (f :: k1 -> k2 -> kr).
( forall a b. (SingI a, SingI b) => SingI (f a b)
, (ApplyTyCon :: (k2 -> kr) -> (k2 ~> kr))
~ ApplyTyConAux1
) => SingI (TyCon2 f) where
sing :: Sing (TyCon2 f)
sing = SingFunction1 (TyCon2 f) -> Sing (TyCon2 f)
forall a1 b (f :: a1 ~> b). SingFunction1 f -> Sing f
singFun1 (Sing t
-> (SingI t => SLambda (TyCon (f t))) -> SLambda (TyCon (f t))
forall k (n :: k) r. Sing n -> (SingI n => r) -> r
`withSingI` SingI t => SLambda (TyCon (f t))
forall k (a :: k). SingI a => Sing a
sing)
instance forall k1 k2 k3 kr (f :: k1 -> k2 -> k3 -> kr).
( forall a b c. (SingI a, SingI b, SingI c) => SingI (f a b c)
, (ApplyTyCon :: (k3 -> kr) -> (k3 ~> kr))
~ ApplyTyConAux1
) => SingI (TyCon3 f) where
sing :: Sing (TyCon3 f)
sing = SingFunction1 (TyCon3 f) -> Sing (TyCon3 f)
forall a1 b (f :: a1 ~> b). SingFunction1 f -> Sing f
singFun1 (Sing t
-> (SingI t => SLambda (TyCon (f t))) -> SLambda (TyCon (f t))
forall k (n :: k) r. Sing n -> (SingI n => r) -> r
`withSingI` SingI t => SLambda (TyCon (f t))
forall k (a :: k). SingI a => Sing a
sing)
instance forall k1 k2 k3 k4 kr (f :: k1 -> k2 -> k3 -> k4 -> kr).
( forall a b c d. (SingI a, SingI b, SingI c, SingI d) => SingI (f a b c d)
, (ApplyTyCon :: (k4 -> kr) -> (k4 ~> kr))
~ ApplyTyConAux1
) => SingI (TyCon4 f) where
sing :: Sing (TyCon4 f)
sing = SingFunction1 (TyCon4 f) -> Sing (TyCon4 f)
forall a1 b (f :: a1 ~> b). SingFunction1 f -> Sing f
singFun1 (Sing t
-> (SingI t => SLambda (TyCon (f t))) -> SLambda (TyCon (f t))
forall k (n :: k) r. Sing n -> (SingI n => r) -> r
`withSingI` SingI t => SLambda (TyCon (f t))
forall k (a :: k). SingI a => Sing a
sing)
instance forall k1 k2 k3 k4 k5 kr
(f :: k1 -> k2 -> k3 -> k4 -> k5 -> kr).
( forall a b c d e.
(SingI a, SingI b, SingI c, SingI d, SingI e)
=> SingI (f a b c d e)
, (ApplyTyCon :: (k5 -> kr) -> (k5 ~> kr))
~ ApplyTyConAux1
) => SingI (TyCon5 f) where
sing :: Sing (TyCon5 f)
sing = SingFunction1 (TyCon5 f) -> Sing (TyCon5 f)
forall a1 b (f :: a1 ~> b). SingFunction1 f -> Sing f
singFun1 (Sing t
-> (SingI t => SLambda (TyCon (f t))) -> SLambda (TyCon (f t))
forall k (n :: k) r. Sing n -> (SingI n => r) -> r
`withSingI` SingI t => SLambda (TyCon (f t))
forall k (a :: k). SingI a => Sing a
sing)
instance forall k1 k2 k3 k4 k5 k6 kr
(f :: k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> kr).
( forall a b c d e f'.
(SingI a, SingI b, SingI c, SingI d, SingI e, SingI f')
=> SingI (f a b c d e f')
, (ApplyTyCon :: (k6 -> kr) -> (k6 ~> kr))
~ ApplyTyConAux1
) => SingI (TyCon6 f) where
sing :: Sing (TyCon6 f)
sing = SingFunction1 (TyCon6 f) -> Sing (TyCon6 f)
forall a1 b (f :: a1 ~> b). SingFunction1 f -> Sing f
singFun1 (Sing t
-> (SingI t => SLambda (TyCon (f t))) -> SLambda (TyCon (f t))
forall k (n :: k) r. Sing n -> (SingI n => r) -> r
`withSingI` SingI t => SLambda (TyCon (f t))
forall k (a :: k). SingI a => Sing a
sing)
instance forall k1 k2 k3 k4 k5 k6 k7 kr
(f :: k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> kr).
( forall a b c d e f' g.
(SingI a, SingI b, SingI c, SingI d, SingI e, SingI f', SingI g)
=> SingI (f a b c d e f' g)
, (ApplyTyCon :: (k7 -> kr) -> (k7 ~> kr))
~ ApplyTyConAux1
) => SingI (TyCon7 f) where
sing :: Sing (TyCon7 f)
sing = SingFunction1 (TyCon7 f) -> Sing (TyCon7 f)
forall a1 b (f :: a1 ~> b). SingFunction1 f -> Sing f
singFun1 (Sing t
-> (SingI t => SLambda (TyCon (f t))) -> SLambda (TyCon (f t))
forall k (n :: k) r. Sing n -> (SingI n => r) -> r
`withSingI` SingI t => SLambda (TyCon (f t))
forall k (a :: k). SingI a => Sing a
sing)
instance forall k1 k2 k3 k4 k5 k6 k7 k8 kr
(f :: k1 -> k2 -> k3 -> k4 -> k5 -> k6 -> k7 -> k8 -> kr).
( forall a b c d e f' g h.
(SingI a, SingI b, SingI c, SingI d, SingI e, SingI f', SingI g, SingI h)
=> SingI (f a b c d e f' g h)
, (ApplyTyCon :: (k8 -> kr) -> (k8 ~> kr))
~ ApplyTyConAux1
) => SingI (TyCon8 f) where
sing :: Sing (TyCon8 f)
sing = SingFunction1 (TyCon8 f) -> Sing (TyCon8 f)
forall a1 b (f :: a1 ~> b). SingFunction1 f -> Sing f
singFun1 (Sing t
-> (SingI t => SLambda (TyCon (f t))) -> SLambda (TyCon (f t))
forall k (n :: k) r. Sing n -> (SingI n => r) -> r
`withSingI` SingI t => SLambda (TyCon (f t))
forall k (a :: k). SingI a => Sing a
sing)
#endif
#if __GLASGOW_HASKELL__ >= 810
type DemoteSym0 :: Type ~> Type
type DemoteSym1 :: Type -> Type
#endif
data DemoteSym0 :: Type ~> Type
type DemoteSym1 x = Demote x
type instance Apply DemoteSym0 x = Demote x
#if __GLASGOW_HASKELL__ >= 810
type SameKindSym0 :: forall k. k ~> k ~> Constraint
type SameKindSym1 :: forall k. k -> k ~> Constraint
type SameKindSym2 :: forall k. k -> k -> Constraint
#endif
data SameKindSym0 :: forall k. k ~> k ~> Constraint
data SameKindSym1 :: forall k. k -> k ~> Constraint
type SameKindSym2 (x :: k) (y :: k) = SameKind x y
type instance Apply SameKindSym0 x = SameKindSym1 x
type instance Apply (SameKindSym1 x) y = SameKind x y
#if __GLASGOW_HASKELL__ >= 810
type KindOfSym0 :: forall k. k ~> Type
type KindOfSym1 :: forall k. k -> Type
#endif
data KindOfSym0 :: forall k. k ~> Type
type KindOfSym1 (x :: k) = KindOf x
type instance Apply KindOfSym0 x = KindOf x
infixr 0 ~>@#@$, ~>@#@$$, ~>@#@$$$
#if __GLASGOW_HASKELL__ >= 810
type (~>@#@$) :: Type ~> Type ~> Type
type (~>@#@$$) :: Type -> Type ~> Type
type (~>@#@$$$) :: Type -> Type -> Type
#endif
data (~>@#@$) :: Type ~> Type ~> Type
data (~>@#@$$) :: Type -> Type ~> Type
type x ~>@#@$$$ y = x ~> y
type instance Apply (~>@#@$) x = (~>@#@$$) x
type instance Apply ((~>@#@$$) x) y = x ~> y
#if __GLASGOW_HASKELL__ >= 810
type ApplySym0 :: forall a b. (a ~> b) ~> a ~> b
type ApplySym1 :: forall a b. (a ~> b) -> a ~> b
type ApplySym2 :: forall a b. (a ~> b) -> a -> b
#endif
data ApplySym0 :: forall a b. (a ~> b) ~> a ~> b
data ApplySym1 :: forall a b. (a ~> b) -> a ~> b
type ApplySym2 (f :: a ~> b) (x :: a) = Apply f x
type instance Apply ApplySym0 f = ApplySym1 f
type instance Apply (ApplySym1 f) x = Apply f x
infixl 9 @@@#@$, @@@#@$$, @@@#@$$$
#if __GLASGOW_HASKELL__ >= 810
type (@@@#@$) :: forall a b. (a ~> b) ~> a ~> b
type (@@@#@$$) :: forall a b. (a ~> b) -> a ~> b
type (@@@#@$$$) :: forall a b. (a ~> b) -> a -> b
#endif
data (@@@#@$) :: forall a b. (a ~> b) ~> a ~> b
data (@@@#@$$) :: forall a b. (a ~> b) -> a ~> b
type (f :: a ~> b) @@@#@$$$ (x :: a) = f @@ x
type instance Apply (@@@#@$) f = (@@@#@$$) f
type instance Apply ((@@@#@$$) f) x = f @@ x