combinat-0.2.8.2: Generate and manipulate various combinatorial objects.

Math.Combinat.TypeLevel

Description

Type-level hackery.

This module is used for groups whose parameters are encoded as type-level natural numbers, for example finite cyclic groups, free groups, symmetric groups and braid groups.

Synopsis

Proxy

data Proxy k t :: forall k. k -> * #

A concrete, poly-kinded proxy type

Constructors

 Proxy

Instances

proxyOf :: a -> Proxy a Source #

proxyOf1 :: f a -> Proxy a Source #

proxyOf2 :: g (f a) -> Proxy a Source #

asProxyTypeOf :: a -> Proxy * a -> a #

asProxyTypeOf is a type-restricted version of const. It is usually used as an infix operator, and its typing forces its first argument (which is usually overloaded) to have the same type as the tag of the second.

asProxyTypeOf1 :: f a -> Proxy a -> f a Source #

Type-level naturals as type arguments

typeArg :: KnownNat n => f (n :: Nat) -> Integer Source #

iTypeArg :: KnownNat n => f (n :: Nat) -> Int Source #

Hiding the type parameter

data Some f Source #

Hide the type parameter of a functor. Example: Some Braid

Constructors

 KnownNat n => Some (f n)

withSome :: Some f -> (forall n. KnownNat n => f n -> a) -> a Source #

Uses the value inside a Some

withSomeM :: Monad m => Some f -> (forall n. KnownNat n => f n -> m a) -> m a Source #

Monadic version of withSome

selectSome :: Integral int => (forall n. KnownNat n => f n) -> int -> Some f Source #

Given a polymorphic value, we select at run time the one specified by the second argument

selectSomeM :: forall m f int. (Integral int, Monad m) => (forall n. KnownNat n => m (f n)) -> int -> m (Some f) Source #

Monadic version of selectSome

withSelected :: Integral int => (forall n. KnownNat n => f n -> a) -> (forall n. KnownNat n => f n) -> int -> a Source #

Combination of selectSome and withSome: we make a temporary structure of the given size, but we immediately consume it.

withSelectedM :: forall m f int a. (Integral int, Monad m) => (forall n. KnownNat n => f n -> a) -> (forall n. KnownNat n => m (f n)) -> int -> m a Source #

(Half-)monadic version of withSelected