HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulesingletons-3.0.3Haskell2010

Data.Singletons.Sigma

Defines Sigma, a dependent pair data type, and related functions.

  • 4 types
  • 4 classes
  • 8 values
  • Packagesingletons-3.0.3
  • Exports19
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceSigma.hs

The Sigma type

5 declarations
datadata Sigma s (a :: s ~> Type) where
#

A dependent pair.

Constructors

Instances3Show, SingI, Sing
familytype family Sing :: k -> Type
#

The singleton kind-indexed type family.

Instances3Sing
  • type Sing = SLambdaDefined in singletons-3.0.3 · Data.Singletons
  • type Sing = SWrappedSingDefined in singletons-3.0.3 · Data.Singletons
  • type Sing = SSigmaDefined in singletons-3.0.3 · Data.Singletons.Sigma

Operations over Sigma

10 declarations
familytype family FstSigma (sig :: Sigma s t) :: s where
#

Project the first element out of a dependent pair.

Equations

valueprojSigma1 :: (forall (fst :: s). Sing fst -> r) -> Sigma s t -> r
#

Project the first element out of a dependent pair using continuation-passing style.

valueprojSigma2 :: (forall (fst :: s). t @@ fst -> r) -> Sigma s t -> r
#

Project the second element out of a dependent pair using continuation-passing style.

valuecurrySigma
  1. :: forall (p :: Sigma a b). SSigma p -> c @@ p
  2. -> forall (x :: a) (sx :: Sing x) (y :: b @@ x). Sing ('WrapSing sx) -> Sing y -> c @@ (sx ':&: y)
#

Convert an uncurried function on Sigma to a curried one.

Together, currySigma and uncurrySigma witness an isomorphism such that the following identities hold:

id1 :: forall a (b :: a ~> Type) (c :: Sigma a b ~> Type).
       (forall (p :: Sigma a b). SSigma p -> c @ p)
    -> (forall (p :: Sigma a b). SSigma p -> c  p)
id1 f = uncurrySigma a b c (currySigma a b c f)

id2 :: forall a (b :: a ~> Type) (c :: Sigma a b ~> Type).
       (forall (x :: a) (sx :: Sing x) (y :: b  x). Sing (WrapSing sx) -> Sing y -> c  (sx :&: y))
    -> (forall (x :: a) (sx :: Sing x) (y :: b  x). Sing (WrapSing sx) -> Sing y -> c  (sx :&: y))
id2 f = currySigma a b c (uncurrySigma a b @c f)

Internal utilities

4 declarations