| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Category.Enriched.Thin
Description
Thin categories, where any two parallel arrows are equal: a ThinProfunctor has at most one
element between any two objects, mere existence being captured by the constraint
. Also defines the codiscrete (always exactly one arrow) and discrete (only
identity arrows) special cases; HasArrow p a bDecidableProfunctors, whose arrows are computed at the type
level as a BOOL (the category thin profunctors are enriched in); and Indexed, Finite and
Enumerable kinds and categories, whose inhabitants are numbered, listed, and reflected to the
value level.
Synopsis
- class Profunctor p => ThinProfunctor (p :: j +-> k) where
- data Decision (p :: j +-> k) (a :: k) (b :: j) (h :: BOOL) where
- mapDecision :: forall {k1} {j1} {k2} {j2} p (a :: k1) (b :: j1) q (c :: k2) (d :: j2) (h :: BOOL). (p a b -> q c d) -> Decision p a b h -> Decision q c d h
- class ThinProfunctor p => DecidableProfunctor (p :: j +-> k) where
- fromHolds :: forall {j} {k} p (a :: k) (b :: j). (DecidableProfunctor p, Ob a, Ob b, Holds p a b ~ 'TRU) => p a b
- noArrow :: forall {j} {k} p (a :: k) (b :: j) r. (DecidableProfunctor p, Holds p a b ~ 'FLS) => p a b -> r
- class (DecidableProfunctor (Hom k), CategoryOf k) => Decidable k
- class (ThinProfunctor (Hom k), CategoryOf k) => Thin k
- class (ThinProfunctor p, Ob a, Ob b, HasArrow p a b) => HasArrow' (p :: j +-> k) (a :: k) (b :: j) where
- arr' :: p a b
- class (ThinProfunctor p, forall (c :: k) (d :: j). (Ob c, Ob d) => HasArrow' p c d, Codiscrete j, Codiscrete k) => CodiscreteProfunctor (p :: j +-> k) where
- type Codiscrete k = CodiscreteProfunctor (Hom k)
- class (c => d, d => c) => c <=> d
- class (HasArrow p a b => Bottom) => HasNoArrow (p :: j +-> k) (a :: k) (b :: j) where
- arrowIsBottomProof :: HasArrow p a b => r
- class (ThinProfunctor p, forall (a :: k) (b :: j). (Ob a, Ob b) => HasNoArrow p a b) => DiscreteProfunctor (p :: j +-> k) where
- exfalso :: forall (a :: k) (b :: j) r. p a b -> r
- class HasArrow (Hom k) c d <=> (c ~ d) => ArrowIsId k (c :: k) (d :: k) where
- arrowIsIdProof :: HasArrow (Hom k) c d => (c ~ d => r) -> r
- class (Thin k, forall (c :: k) (d :: k). (Ob c, Ob d) => ArrowIsId k c d) => Discrete k where
- class Indexed k where
- class (SNatI (Index a), At k (Index a) ~ 'Just a) => KnownIndex (a :: k)
- type family NatEq (n :: Nat) (m :: Nat) :: BOOL where ...
- natEq :: forall (n :: Nat) (m :: Nat). SNat n -> SNat m -> Decision ((:~:) :: Nat -> Nat -> Type) n m (NatEq n m)
- withNatEqRefl :: forall (n :: Nat) r. SNat n -> (NatEq n n ~ 'TRU => r) -> r
- type Equal (a :: k) (b :: k) = NatEq (Index a) (Index b)
- decideEq :: forall {k} (a :: k) (b :: k). (KnownIndex a, KnownIndex b) => Decision ((:~:) :: k -> k -> Type) a b (Equal a b)
- type family Length (xs :: [k]) :: Nat where ...
- type family Lookup (xs :: [k]) (i :: Nat) :: Maybe k where ...
- type family Entry (xs :: [k]) (i :: Nat) :: k where ...
- class KnownList (c :: x -> Constraint) (shape :: [y]) (xs :: [x]) where
- type family IndexOf (a :: k) (xs :: [k]) :: Nat where ...
- data IndexedList (as :: [k]) where
- FNil :: forall {k}. IndexedList ('[] :: [k])
- FCons :: forall {k} (a :: k) (as1 :: [k]). KnownIndex a => IndexedList as1 -> IndexedList (a ': as1)
- class HasFiniteDefault (xs :: [k]) where
- finiteDefault :: IndexedList xs
- class Indexed k => Finite k where
- data Member (a :: k) (as :: [k]) where
- memberIndex :: forall {k} (a :: k). (Finite k, KnownIndex a) => Member a (Objects k)
- class (CategoryOf k, Finite k) => Enumerable k where
- member :: forall {k} (a :: k). (Enumerable k, Ob a) => Member a (Objects k)
- data AtOb k (x :: Maybe k) where
- noIndex :: forall {k} (a :: k) r. KnownIndex a => (At k (Index a) :~: ('Nothing :: Maybe k)) -> r
- type family FmapWrap (w :: j -> k) (x :: Maybe j) :: Maybe k where ...
- type family MapWrap (w :: j -> k) (xs :: [j]) :: [k] where ...
- mapWrap :: forall {j} {k} (w :: j -> k) (xs :: [j]). (forall (a :: j). KnownIndex a => KnownIndex (w a)) => IndexedList xs -> IndexedList (MapWrap w xs)
- withLookupMapWrap :: forall {j} {k} (w :: j -> k) (xs :: [j]) (i :: Nat) r. SNat i -> IndexedList xs -> (Lookup (MapWrap w xs) i ~ FmapWrap w (Lookup xs i) => r) -> r
- wrapFinite :: forall {j} {k} (w :: j -> k). (Finite j, forall (a :: j). KnownIndex a => KnownIndex (w a)) => IndexedList (MapWrap w (Objects j))
- withWrapAtLookup :: forall {j} {k} (w :: j -> k) (i :: Nat) r. Finite j => SNat i -> (Lookup (MapWrap w (Objects j)) i ~ FmapWrap w (At j i) => r) -> r
- lookupOb :: forall k (j :: Nat) (xs :: [k]). Enumerable k => SNat j -> IndexedList xs -> AtOb k (Lookup xs j)
Documentation
class Profunctor p => ThinProfunctor (p :: j +-> k) where Source Github #
The defaults take everything from a DecidableProfunctor instance: the arrow exists when
computes to Holds p a bTRU.
Minimal complete definition
Nothing
Methods
arr :: forall (a :: k) (b :: j). (Ob a, Ob b, HasArrow p a b) => p a b Source Github #
default arr :: forall (a :: k) (b :: j). (Ob a, Ob b, DecidableProfunctor p, Holds p a b ~ 'TRU) => p a b Source Github #
withArr :: forall (a :: k) (b :: j) r. p a b -> ((HasArrow p a b, Ob a, Ob b) => r) -> r Source Github #
Instances
Decidable thin profunctors
data Decision (p :: j +-> k) (a :: k) (b :: j) (h :: BOOL) where Source Github #
mapDecision :: forall {k1} {j1} {k2} {j2} p (a :: k1) (b :: j1) q (c :: k2) (d :: j2) (h :: BOOL). (p a b -> q c d) -> Decision p a b h -> Decision q c d h Source Github #
class ThinProfunctor p => DecidableProfunctor (p :: j +-> k) where Source Github #
A thin profunctor whose arrows are decidable at the type level: is the
Holds p a bBOOL-valued profunctor a thin profunctor really is, computed by a type family, so it reduces to
TRU or FLS for concrete objects. It agrees with HasArrow (fromHolds and toHolds are the
two directions of that agreement, and the ThinProfunctor defaults make it definitional), and
decide computes the answer at the value level, arrow included. With it a composite of thin
profunctors can search for its middle object (Proarrow.Category.Enriched.Thin.Composition).
Methods
decide :: forall (a :: k) (b :: j). (Ob a, Ob b) => Decision p a b (Holds p a b) Source Github #
toHolds :: forall (a :: k) (b :: j) r. p a b -> ((Holds p a b ~ 'TRU, Ob a, Ob b) => r) -> r Source Github #
Instances
| DecidableProfunctor Booleans Source Github # | |||||
Defined in Proarrow.Category.Enriched.Thin | |||||
| DecidableProfunctor GTE Source Github # | Decided by comparing the naturals; | ||||
| DecidableProfunctor Zero Source Github # | |||||
Defined in Proarrow.Category.Enriched.Thin | |||||
| DecidableProfunctor Unit Source Github # | |||||
Defined in Proarrow.Category.Instance.Unit Associated Types
| |||||
| (Ob ff, Ob tt) => DecidableProfunctor (NonTrivialProfunctor '(ff, tt) :: BOOL -> BOOL -> Type) Source Github # | |||||
Defined in Proarrow.Category.Enriched.Thin Methods decide :: forall (a :: BOOL) (b :: BOOL). (Ob a, Ob b) => Decision (NonTrivialProfunctor '(ff, tt)) a b (Holds (NonTrivialProfunctor '(ff, tt)) a b) Source Github # toHolds :: forall (a :: BOOL) (b :: BOOL) r. NonTrivialProfunctor '(ff, tt) a b -> ((Holds (NonTrivialProfunctor '(ff, tt)) a b ~ 'TRU, Ob a, Ob b) => r) -> r Source Github # | |||||
| DecidableProfunctor (Hom k) => DecidableProfunctor (Id :: k -> k -> Type) Source Github # | |||||
Defined in Proarrow.Profunctor.Instance.Identity | |||||
| (Thin j, Thin k) => DecidableProfunctor (InitialProfunctor :: k -> j -> Type) Source Github # | |||||
Defined in Proarrow.Profunctor.Instance.Initial Methods decide :: forall (a :: k) (b :: j). (Ob a, Ob b) => Decision (InitialProfunctor :: k -> j -> Type) a b (Holds (InitialProfunctor :: k -> j -> Type) a b) Source Github # toHolds :: forall (a :: k) (b :: j) r. InitialProfunctor a b -> ((Holds (InitialProfunctor :: k -> j -> Type) a b ~ 'TRU, Ob a, Ob b) => r) -> r Source Github # | |||||
| (CategoryOf j, CategoryOf k) => DecidableProfunctor (TerminalProfunctor :: k -> j -> Type) Source Github # | |||||
Defined in Proarrow.Profunctor.Instance.Terminal Methods decide :: forall (a :: k) (b :: j). (Ob a, Ob b) => Decision (TerminalProfunctor :: k -> j -> Type) a b (Holds (TerminalProfunctor :: k -> j -> Type) a b) Source Github # toHolds :: forall (a :: k) (b :: j) r. TerminalProfunctor a b -> ((Holds (TerminalProfunctor :: k -> j -> Type) a b ~ 'TRU, Ob a, Ob b) => r) -> r Source Github # | |||||
| (Thin j, Thin k, DecidableProfunctor p) => DecidableProfunctor (UnOp p :: k -> j -> Type) Source Github # | |||||
| (Relation p, DecidableProfunctor p) => DecidableProfunctor (Converse p :: k -> j -> Type) Source Github # | |||||
| (FunctorForRep f, DecidableProfunctor (Hom j)) => DecidableProfunctor (Corep f :: k -> j -> Type) Source Github # | |||||
| (Functor f, DecidableProfunctor (Hom j)) => DecidableProfunctor (Costar f :: k -> j -> Type) Source Github # | |||||
| (Functor f, DecidableProfunctor (Hom k)) => DecidableProfunctor (Star f :: k -> j -> Type) Source Github # | |||||
| (Corepresentable p, DecidableProfunctor (Hom k)) => DecidableProfunctor (CorepStar p :: k -> j -> Type) Source Github # | |||||
Defined in Proarrow.Profunctor.Representable | |||||
| (FunctorForRep f, DecidableProfunctor (Hom k)) => DecidableProfunctor (Rep f :: k -> j -> Type) Source Github # | |||||
| (Representable p, DecidableProfunctor (Hom j)) => DecidableProfunctor (RepCostar p :: k -> j -> Type) Source Github # | |||||
Defined in Proarrow.Profunctor.Representable | |||||
| (SNatI n, DecidableProfunctor p, Decidable k, Enumerable k) => DecidableProfunctor (Walk n p :: k -> k -> Type) Source Github # | Reachability: the truth of a walk is its hom-object in | ||||
Defined in Proarrow.Category.Enriched.Thin.Composition | |||||
| (DecidableProfunctor p, DecidableProfunctor q, Discrete j, Discrete k) => DecidableProfunctor (p :~>: q :: k -> j -> Type) Source Github # | Implication, decided: the exponential holds unless | ||||
| (DecidableProfunctor p, DecidableProfunctor q) => DecidableProfunctor (p :*: q :: k -> j -> Type) Source Github # | |||||
| (DecidableProfunctor (Hom k), FunctorForRep f, FunctorForRep g) => DecidableProfunctor (Direp f g :: j -> i -> Type) Source Github # | |||||
| DecideComp (ThinCompStrategy p q) p q => DecidableProfunctor (p :.: q :: k -> j2 -> Type) Source Github # | |||||
Defined in Proarrow.Category.Enriched.Thin.Composition | |||||
| Indexed k => DecidableProfunctor (Codiscrete :: CODISCRETE k -> CODISCRETE k -> Type) Source Github # | |||||
Defined in Proarrow.Category.Instance.Discrete Methods decide :: forall (a :: CODISCRETE k) (b :: CODISCRETE k). (Ob a, Ob b) => Decision (Codiscrete :: CODISCRETE k -> CODISCRETE k -> Type) a b (Holds (Codiscrete :: CODISCRETE k -> CODISCRETE k -> Type) a b) Source Github # toHolds :: forall (a :: CODISCRETE k) (b :: CODISCRETE k) r. Codiscrete a b -> ((Holds (Codiscrete :: CODISCRETE k -> CODISCRETE k -> Type) a b ~ 'TRU, Ob a, Ob b) => r) -> r Source Github # | |||||
| Indexed k => DecidableProfunctor (Discrete :: DISCRETE k -> DISCRETE k -> Type) Source Github # | Two points are equal exactly when their indices are. | ||||
Defined in Proarrow.Category.Instance.Discrete Methods decide :: forall (a :: DISCRETE k) (b :: DISCRETE k). (Ob a, Ob b) => Decision (Discrete :: DISCRETE k -> DISCRETE k -> Type) a b (Holds (Discrete :: DISCRETE k -> DISCRETE k -> Type) a b) Source Github # toHolds :: forall (a :: DISCRETE k) (b :: DISCRETE k) r. Discrete a b -> ((Holds (Discrete :: DISCRETE k -> DISCRETE k -> Type) a b ~ 'TRU, Ob a, Ob b) => r) -> r Source Github # | |||||
| DecidableProfunctor (LTE :: ORDINAL n -> ORDINAL n -> Type) Source Github # | |||||
Defined in Proarrow.Category.Instance.Ordinal Methods decide :: forall (a :: ORDINAL n) (b :: ORDINAL n). (Ob a, Ob b) => Decision (LTE :: ORDINAL n -> ORDINAL n -> Type) a b (Holds (LTE :: ORDINAL n -> ORDINAL n -> Type) a b) Source Github # toHolds :: forall (a :: ORDINAL n) (b :: ORDINAL n) r. LTE a b -> ((Holds (LTE :: ORDINAL n -> ORDINAL n -> Type) a b ~ 'TRU, Ob a, Ob b) => r) -> r Source Github # | |||||
| (Indexed k, KnownEdges es) => DecidableProfunctor (Edges es :: DISCRETE k -> DISCRETE k -> Type) Source Github # | |||||
Defined in Proarrow.Profunctor.Instance.Edges | |||||
| DecidableProfunctor p => DecidableProfunctor (Op p :: OPPOSITE j -> OPPOSITE k -> Type) Source Github # | |||||
Defined in Proarrow.Category.Instance.Opposite | |||||
| (DecidableProfunctor p, Promonad p) => DecidableProfunctor (Kleisli :: KLEISLI p -> KLEISLI p -> Type) Source Github # | |||||
Defined in Proarrow.Category.Instance.Kleisli Methods decide :: forall (a :: KLEISLI p) (b :: KLEISLI p). (Ob a, Ob b) => Decision (Kleisli :: KLEISLI p -> KLEISLI p -> Type) a b (Holds (Kleisli :: KLEISLI p -> KLEISLI p -> Type) a b) Source Github # toHolds :: forall (a :: KLEISLI p) (b :: KLEISLI p) r. Kleisli a b -> ((Holds (Kleisli :: KLEISLI p -> KLEISLI p -> Type) a b ~ 'TRU, Ob a, Ob b) => r) -> r Source Github # | |||||
| (DecidableProfunctor p, DecidableProfunctor q) => DecidableProfunctor (p :**: q :: (k1, k2) -> (j1, j2) -> Type) Source Github # | A product holds when both components do: the type-level | ||||
Defined in Proarrow.Limit.BinaryProduct | |||||
| (Decidable j, Decidable k, DecidableProfunctor p) => DecidableProfunctor (Collage :: COLLAGE p -> COLLAGE p -> Type) Source Github # | Decided piecewise: within either side by that side's order, across by | ||||
Defined in Proarrow.Category.Instance.Collage Methods decide :: forall (a :: COLLAGE p) (b :: COLLAGE p). (Ob a, Ob b) => Decision (Collage :: COLLAGE p -> COLLAGE p -> Type) a b (Holds (Collage :: COLLAGE p -> COLLAGE p -> Type) a b) Source Github # toHolds :: forall (a :: COLLAGE p) (b :: COLLAGE p) r. Collage a b -> ((Holds (Collage :: COLLAGE p -> COLLAGE p -> Type) a b ~ 'TRU, Ob a, Ob b) => r) -> r Source Github # | |||||
fromHolds :: forall {j} {k} p (a :: k) (b :: j). (DecidableProfunctor p, Ob a, Ob b, Holds p a b ~ 'TRU) => p a b Source Github #
noArrow :: forall {j} {k} p (a :: k) (b :: j) r. (DecidableProfunctor p, Holds p a b ~ 'FLS) => p a b -> r Source Github #
A profunctor that decides against an arrow has none, so a caller holding one may return anything.
class (DecidableProfunctor (Hom k), CategoryOf k) => Decidable k Source Github #
A thin category whose order is decidable at the type level.
Instances
| (DecidableProfunctor (Hom k), CategoryOf k) => Decidable k Source Github # | |
Defined in Proarrow.Category.Enriched.Thin | |
class (ThinProfunctor (Hom k), CategoryOf k) => Thin k Source Github #
Instances
| (ThinProfunctor (Hom k), CategoryOf k) => Thin k Source Github # | |
Defined in Proarrow.Category.Enriched.Thin | |
class (ThinProfunctor p, Ob a, Ob b, HasArrow p a b) => HasArrow' (p :: j +-> k) (a :: k) (b :: j) where Source Github #
class (ThinProfunctor p, forall (c :: k) (d :: j). (Ob c, Ob d) => HasArrow' p c d, Codiscrete j, Codiscrete k) => CodiscreteProfunctor (p :: j +-> k) where Source Github #
Instances
| (ThinProfunctor p, forall (c :: k) (d :: j). (Ob c, Ob d) => HasArrow' p c d, Codiscrete j, Codiscrete k) => CodiscreteProfunctor (p :: j +-> k) Source Github # | |
type Codiscrete k = CodiscreteProfunctor (Hom k) Source Github #
class (c => d, d => c) => c <=> d Source Github #
Instances
| (c => d, d => c) => c <=> d Source Github # | |
Defined in Proarrow.Category.Enriched.Thin | |
class (HasArrow p a b => Bottom) => HasNoArrow (p :: j +-> k) (a :: k) (b :: j) where Source Github #
Methods
arrowIsBottomProof :: HasArrow p a b => r Source Github #
Instances
| (HasArrow p a b => Bottom) => HasNoArrow (p :: j +-> k) (a :: k) (b :: j) Source Github # | |
Defined in Proarrow.Category.Enriched.Thin Methods arrowIsBottomProof :: HasArrow p a b => r Source Github # | |
class (ThinProfunctor p, forall (a :: k) (b :: j). (Ob a, Ob b) => HasNoArrow p a b) => DiscreteProfunctor (p :: j +-> k) where Source Github #
Instances
| (ThinProfunctor p, forall (a :: k) (b :: j). (Ob a, Ob b) => HasNoArrow p a b) => DiscreteProfunctor (p :: j +-> k) Source Github # | |
Defined in Proarrow.Category.Enriched.Thin | |
class (Thin k, forall (c :: k) (d :: k). (Ob c, Ob d) => ArrowIsId k c d) => Discrete k where Source Github #
Discrete k is not the same as DiscreteProfunctor (Hom k)!
Indexed, finite and enumerable kinds
class Indexed k Source Github #
A kind whose inhabitants are numbered: Index gives each its position and At reads it back,
so that two inhabitants are equal exactly when their indices are (decideEq). At is partial, so
that finitely many inhabitants can be numbered by an initial segment of the naturals.
Associated Types
type Index (a :: k) :: Nat Source Github #
Instances
| Indexed Nat Source Github # | |||||||||
Defined in Proarrow.Category.Enriched.Thin | |||||||||
| Indexed BOOL Source Github # | |||||||||
| Indexed VOID Source Github # | The empty kind has no inhabitants to number. | ||||||||
Defined in Proarrow.Category.Enriched.Thin | |||||||||
| Indexed () Source Github # | |||||||||
Defined in Proarrow.Category.Instance.Unit Associated Types
| |||||||||
| Indexed k => Indexed (CODISCRETE k) Source Github # | |||||||||
Defined in Proarrow.Category.Instance.Discrete | |||||||||
| Indexed k => Indexed (DISCRETE k) Source Github # | |||||||||
Defined in Proarrow.Category.Instance.Discrete | |||||||||
| Indexed k => Indexed (OPPOSITE k) Source Github # | The opposite category has the same objects, numbered the same way. | ||||||||
Defined in Proarrow.Category.Instance.Opposite | |||||||||
| Indexed (ORDINAL n) Source Github # | |||||||||
Defined in Proarrow.Category.Instance.Ordinal | |||||||||
| Indexed k => Indexed (KLEISLI p) Source Github # | The Kleisli category has the objects of | ||||||||
Defined in Proarrow.Category.Instance.Kleisli | |||||||||
| Indexed (MONOID m) Source Github # | A monoid is a one-object category, so its kind has one inhabitant, at index zero. This is
stated directly instead of left to the | ||||||||
Defined in Proarrow.Category.Instance.Monoid | |||||||||
| Indexed k => Indexed (PATHS p) Source Github # | Objects are vertices, so a free category has as many of them as its quiver has, however many
arrows the paths add (usually unboundedly many). So a free category is | ||||||||
Defined in Proarrow.Category.Instance.Paths | |||||||||
| InternalIn ik FINSET => Indexed (INTERNAL ik) Source Github # | |||||||||
Defined in Proarrow.Category.Internal | |||||||||
| Indexed (BOOL, BOOL) Source Github # | The product of two enumerable kinds is enumerable, but numbering one in general needs type-level
division to invert the pairing, which (Proarrow.Category.Sheaf uses this kind as the opens of a discrete two-point space: a pair of
booleans is a subset of | ||||||||
Defined in Proarrow.Category.Instance.Product | |||||||||
| (Finite j, Finite k) => Indexed (COLLAGE p) Source Github # | |||||||||
Defined in Proarrow.Category.Instance.Collage | |||||||||
class (SNatI (Index a), At k (Index a) ~ 'Just a) => KnownIndex (a :: k) Source Github #
The evidence that a is numbered: its index, reflected, and At reading it back.
type family NatEq (n :: Nat) (m :: Nat) :: BOOL where ... Source Github #
Equality of naturals, with evidence either way.
natEq :: forall (n :: Nat) (m :: Nat). SNat n -> SNat m -> Decision ((:~:) :: Nat -> Nat -> Type) n m (NatEq n m) Source Github #
type Equal (a :: k) (b :: k) = NatEq (Index a) (Index b) Source Github #
Two numbered inhabitants are equal exactly when their indices are.
decideEq :: forall {k} (a :: k) (b :: k). (KnownIndex a, KnownIndex b) => Decision ((:~:) :: k -> k -> Type) a b (Equal a b) Source Github #
type family Entry (xs :: [k]) (i :: Nat) :: k where ... Source Github #
class KnownList (c :: x -> Constraint) (shape :: [y]) (xs :: [x]) where Source Github #
Every entry of xs satisfies c. The list is shaped like shape, a list of objects, so that
an index into shape selects an entry of xs. The equality argument ties the index to shape,
so that walking off the end is refutable rather than an error.
Methods
withEntry :: forall (s :: y) (i :: Nat) r. SNat i -> (Lookup shape i :~: 'Just s) -> (c (Entry xs i) => r) -> r Source Github #
type family IndexOf (a :: k) (xs :: [k]) :: Nat where ... Source Github #
Where an inhabitant sits in a type-level list, the inverse of Lookup. An inhabitant that does
not occur has no index, so the family is stuck rather than total.
data IndexedList (as :: [k]) where Source Github #
A type-level list of inhabitants, reflected to the value level with their indices.
Constructors
| FNil :: forall {k}. IndexedList ('[] :: [k]) | |
| FCons :: forall {k} (a :: k) (as1 :: [k]). KnownIndex a => IndexedList as1 -> IndexedList (a ': as1) |
class HasFiniteDefault (xs :: [k]) where Source Github #
Every element of the list is numbered, so the list can be reflected to an IndexedList. So a
kind that simply writes its objects out gets finite for free.
Methods
finiteDefault :: IndexedList xs Source Github #
Instances
| HasFiniteDefault ('[] :: [k]) Source Github # | |
Defined in Proarrow.Category.Enriched.Thin Methods finiteDefault :: IndexedList ('[] :: [k]) Source Github # | |
| (KnownIndex a, HasFiniteDefault as) => HasFiniteDefault (a ': as :: [k]) Source Github # | |
Defined in Proarrow.Category.Enriched.Thin Methods finiteDefault :: IndexedList (a ': as) Source Github # | |
class Indexed k => Finite k where Source Github #
An Indexed kind with finitely many inhabitants, listed in Objects in the order of their
indices: withAtLookup says that the list tabulates At.
Minimal complete definition
Nothing
Methods
finite :: IndexedList (Objects k) Source Github #
default finite :: HasFiniteDefault (Objects k) => IndexedList (Objects k) Source Github #
withAtLookup :: forall (i :: Nat) r. SNat i -> (Lookup (Objects k) i ~ At k i => r) -> r Source Github #
Instances
| Finite BOOL Source Github # | |||||
Defined in Proarrow.Category.Enriched.Thin Associated Types
| |||||
| Finite VOID Source Github # | |||||
Defined in Proarrow.Category.Enriched.Thin Associated Types
| |||||
| Finite () Source Github # | |||||
Defined in Proarrow.Category.Instance.Unit Associated Types
| |||||
| Finite k => Finite (CODISCRETE k) Source Github # | |||||
Defined in Proarrow.Category.Instance.Discrete Associated Types
Methods finite :: IndexedList (Objects (CODISCRETE k)) Source Github # withAtLookup :: forall (i :: Nat) r. SNat i -> (Lookup (Objects (CODISCRETE k)) i ~ At (CODISCRETE k) i => r) -> r Source Github # | |||||
| Finite k => Finite (DISCRETE k) Source Github # | |||||
Defined in Proarrow.Category.Instance.Discrete | |||||
| Finite k => Finite (OPPOSITE k) Source Github # | |||||
Defined in Proarrow.Category.Instance.Opposite | |||||
| SNatI n => Finite (ORDINAL n) Source Github # | |||||
Defined in Proarrow.Category.Instance.Ordinal Associated Types
| |||||
| Finite k => Finite (KLEISLI p) Source Github # | |||||
Defined in Proarrow.Category.Instance.Kleisli | |||||
| Finite (MONOID m) Source Github # | |||||
Defined in Proarrow.Category.Instance.Monoid Associated Types
| |||||
| Finite k => Finite (PATHS p) Source Github # | |||||
Defined in Proarrow.Category.Instance.Paths | |||||
| (InternalIn ik FINSET, SNatI (NumObs ik)) => Finite (INTERNAL ik) Source Github # | |||||
Defined in Proarrow.Category.Internal | |||||
| Finite (BOOL, BOOL) Source Github # | |||||
Defined in Proarrow.Category.Instance.Product | |||||
| (Finite j, Finite k) => Finite (COLLAGE p) Source Github # | |||||
Defined in Proarrow.Category.Instance.Collage Associated Types
| |||||
data Member (a :: k) (as :: [k]) where Source Github #
A proof that a occurs in the type-level list as.
memberIndex :: forall {k} (a :: k). (Finite k, KnownIndex a) => Member a (Objects k) Source Github #
Every numbered inhabitant of a finite kind occurs in its list: walk to its index.
class (CategoryOf k, Finite k) => Enumerable k where Source Github #
A category on a Finite kind whose objects are exactly its numbered inhabitants: withIndex
and withOb convert between the two notions, and atOb looks an object up by its index.
Methods
withIndex :: forall (a :: k) r. Ob a => (KnownIndex a => r) -> r Source Github #
withOb :: forall (a :: k) r. KnownIndex a => (Ob a => r) -> r Source Github #
atOb :: forall (i :: Nat). SNat i -> AtOb k (At k i) Source Github #
The object at an index, if there is one. The default walks the object list, which is all a
kind in general can do. A kind that can answer from the index alone should say so, and a wrapper
kind whose base is itself Enumerable should defer to it. The discrete kinds cannot, since
they ask only that the kind they wrap be Finite.
Instances
| Enumerable BOOL Source Github # | |
| Enumerable VOID Source Github # | |
| Enumerable () Source Github # | |
| Finite k => Enumerable (CODISCRETE k) Source Github # | |
Defined in Proarrow.Category.Instance.Discrete Methods withIndex :: forall (a :: CODISCRETE k) r. Ob a => (KnownIndex a => r) -> r Source Github # withOb :: forall (a :: CODISCRETE k) r. KnownIndex a => (Ob a => r) -> r Source Github # atOb :: forall (i :: Nat). SNat i -> AtOb (CODISCRETE k) (At (CODISCRETE k) i) Source Github # | |
| Finite k => Enumerable (DISCRETE k) Source Github # | |
Defined in Proarrow.Category.Instance.Discrete | |
| Enumerable k => Enumerable (OPPOSITE k) Source Github # | |
Defined in Proarrow.Category.Instance.Opposite | |
| SNatI n => Enumerable (ORDINAL n) Source Github # | |
Defined in Proarrow.Category.Instance.Ordinal | |
| (Enumerable k, Promonad p) => Enumerable (KLEISLI p) Source Github # | |
Defined in Proarrow.Category.Instance.Kleisli | |
| Monoid m => Enumerable (MONOID m) Source Github # | |
Defined in Proarrow.Category.Instance.Monoid | |
| (Enumerable k, Rewrite p) => Enumerable (PATHS p) Source Github # | |
Defined in Proarrow.Category.Instance.Paths | |
| (InternalIn ik FINSET, SNatI (NumObs ik)) => Enumerable (INTERNAL ik) Source Github # | |
Defined in Proarrow.Category.Internal | |
| Enumerable (BOOL, BOOL) Source Github # | |
Defined in Proarrow.Category.Instance.Product | |
| (Enumerable j, Enumerable k, Profunctor p) => Enumerable (COLLAGE p) Source Github # | |
Defined in Proarrow.Category.Instance.Collage | |
member :: forall {k} (a :: k). (Enumerable k, Ob a) => Member a (Objects k) Source Github #
Locate an object in the object list.
noIndex :: forall {k} (a :: k) r. KnownIndex a => (At k (Index a) :~: ('Nothing :: Maybe k)) -> r Source Github #
A numbered inhabitant is found at its own index, so evidence that nothing is there refutes
itself: under the argument's type is KnownIndex a', and a caller
holding one may return anything.Just a :~: 'Nothing
type family FmapWrap (w :: j -> k) (x :: Maybe j) :: Maybe k where ... Source Github #
A kind that wraps another, one inhabitant for one, keeps its numbering: map the wrapper over the
lookup (FmapWrap) and over the object list (MapWrap), and the two agree (withLookupMapWrap).
mapWrap :: forall {j} {k} (w :: j -> k) (xs :: [j]). (forall (a :: j). KnownIndex a => KnownIndex (w a)) => IndexedList xs -> IndexedList (MapWrap w xs) Source Github #
withLookupMapWrap :: forall {j} {k} (w :: j -> k) (xs :: [j]) (i :: Nat) r. SNat i -> IndexedList xs -> (Lookup (MapWrap w xs) i ~ FmapWrap w (Lookup xs i) => r) -> r Source Github #
wrapFinite :: forall {j} {k} (w :: j -> k). (Finite j, forall (a :: j). KnownIndex a => KnownIndex (w a)) => IndexedList (MapWrap w (Objects j)) Source Github #
The two Finite methods of a wrapper kind, which are the same for every wrapper.