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 declarationsUnicode shorthand for Sigma.
The singleton kind-indexed type family.
The singleton type for Sigma.
Instances1Show
(ShowSing s, ShowSingApply t) => Show (SSigma sig)Defined in singletons-3.0.3 · Data.Singletons.Sigma
Unicode shorthand for SSigma.
Operations over Sigma
10 declarationsProject the first element out of a dependent pair.
Project the second element out of a dependent pair.
Project the first element out of a dependent pair using continuation-passing style.
Project the second element out of a dependent pair using continuation-passing style.
Map across a Sigma value in a dependent fashion.
Zip two Sigma values together in a dependent fashion.
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)
Convert a curried function on Sigma to an uncurried one.
Together, currySigma and uncurrySigma witness an isomorphism. (Refer to the documentation for currySigma for more details.)
Internal utilities
4 declarationsInstances1ShowApply
(forall (x :: a). ShowApply' f x) => ShowApply fDefined in singletons-3.0.3 · Data.Singletons.Sigma
class (forall (x :: a) (z :: Apply f x). ShowSingApply' f x z) => ShowSingApply (f :: a ~> Type)Instances1ShowSingApply
(forall (x :: a) (z :: Apply f x). ShowSingApply' f x z) => ShowSingApply fDefined in singletons-3.0.3 · Data.Singletons.Sigma
Instances1ShowApply'
Show (Apply f x) => ShowApply' f xDefined in singletons-3.0.3 · Data.Singletons.Sigma
Instances1ShowSingApply'
Show (Sing z) => ShowSingApply' f x zDefined in singletons-3.0.3 · Data.Singletons.Sigma