| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Profunctor.Free
Contents
Description
Free constructions: HasFree captures the object constraints ob whose forgetful functor has a left
adjoint, with Free ob the free object, lift the unit and foldMap the universal property of the
adjunction (packaged as a Corepresentable heteromorphism profunctor).
Synopsis
- class (CategoryOf k, forall (a :: k). Ob a => ob (Free ob a)) => HasFree (ob :: OB k) where
- retract :: forall {k} (ob :: OB k) (a :: k). (HasFree ob, ob a, Ob a) => Free ob a ~> a
- freeMap :: forall {k} (ob :: OB k) (a :: k) (b :: k). HasFree ob => (a ~> b) -> Free ob a ~> Free ob b
- freeComp :: forall {k} (ob :: OB k) (c :: k) (b :: k) (a :: k). (HasFree ob, Ob c) => (b ~> Free ob c) -> (a ~> Free ob b) -> a ~> Free ob c
- data Ap (f :: k -> Type) (a :: k) where
- retractAp :: forall {k} f (a :: k). Applicative f => Ap f a -> f a
- data FreePromonad (p :: k -> k -> Type) (a :: k) (b :: k) where
- Unit :: forall {k} (a :: k) (b :: k) (p :: k -> k -> Type). (a ~> b) -> FreePromonad p a b
- Comp :: forall {k} (p :: k -> k -> Type) (a :: k) (b1 :: k) (b :: k). p a b1 -> FreePromonad p b1 b -> FreePromonad p a b
- freePromonadAlg :: forall {k} (p :: k +-> k) (a :: k) (b :: k). (p :.: FreePromonad p) a b -> FreePromonad p a b
- foldFreePromonad :: forall {k1} (q :: CAT k1) (p :: k1 -> k1 -> Type). Promonad q => (p :~> q) -> FreePromonad p :~> q
- type family FreeK (b :: Kind -> Constraint) (c :: Kind -> Constraint) k
- class c (FreeK b c k) => FreeK' (b :: Kind -> Constraint) (c :: Kind -> Constraint) k
- type family Lift (b :: Kind -> Constraint) (c :: Kind -> Constraint) (a :: k) :: FreeK b c k
- type family Retract (b :: Kind -> Constraint) (c :: Kind -> Constraint) k (a :: FreeK b c k) :: k
- class (forall k. b k => FreeK' b c k) => HasFreeK (b :: Kind -> Constraint) (c :: Kind -> Constraint) where
Documentation
class (CategoryOf k, forall (a :: k). Ob a => ob (Free ob a)) => HasFree (ob :: OB k) where Source Github #
Methods
lift :: forall (a :: k). Ob a => a ~> Free ob a Source Github #
foldMap :: forall (b :: k) (a :: k). ob b => (a ~> b) -> Free ob a ~> b Source Github #
Instances
retract :: forall {k} (ob :: OB k) (a :: k). (HasFree ob, ob a, Ob a) => Free ob a ~> a Source Github #
freeMap :: forall {k} (ob :: OB k) (a :: k) (b :: k). HasFree ob => (a ~> b) -> Free ob a ~> Free ob b Source Github #
freeComp :: forall {k} (ob :: OB k) (c :: k) (b :: k) (a :: k). (HasFree ob, Ob c) => (b ~> Free ob c) -> (a ~> Free ob b) -> a ~> Free ob c Source Github #
data Ap (f :: k -> Type) (a :: k) where Source Github #
The free Applicative on a functor f (the HasFree instance for Applicative): formal pure,
effect and liftA2 nodes, retracted into any applicative by retractAp.
Constructors
| Pure :: forall {k} (a :: k) (f :: k -> Type). ((Unit :: k) ~> a) -> Ap f a | |
| Eff :: forall {k} (f :: k -> Type) (a :: k). f a -> Ap f a | |
| LiftA2 :: forall {k} (a1 :: k) (b :: k) (a :: k) (f :: k -> Type). (Ob a1, Ob b) => ((a1 ** b) ~> a) -> Ap f a1 -> Ap f b -> Ap f a |
Instances
| (Monoidal k, Functor f) => Applicative (Ap f :: k -> Type) Source Github # | |
| (CategoryOf k, Functor f) => Functor (Ap f :: k -> Type) Source Github # | |
| Functor (Ap :: (k -> Type) -> k -> Type) Source Github # | |
| Monoidal k => Promonad (Star (Ap :: (k -> Type) -> k -> Type) :: (k -> Type) -> (k -> Type) -> Type) Source Github # | |
Defined in Proarrow.Profunctor.Free Methods id :: forall (a :: k -> Type). Ob a => Star (Ap :: (k -> Type) -> k -> Type) a a Source Github # (.) :: forall (b :: k -> Type) (c :: k -> Type) (a :: k -> Type). Star (Ap :: (k -> Type) -> k -> Type) b c -> Star (Ap :: (k -> Type) -> k -> Type) a b -> Star (Ap :: (k -> Type) -> k -> Type) a c Source Github # | |
| (Monoidal k, Monoid m) => Monoid (Ap f m) Source Github # | |
| (Monoidal k, Monoid m) => Semigroup (Ap f m) Source Github # | Given as |
data FreePromonad (p :: k -> k -> Type) (a :: k) (b :: k) where Source Github #
The free Promonad on a profunctor p: a chain of ps ending in a hom arrow, folded into any
promonad by foldFreePromonad.
Constructors
| Unit :: forall {k} (a :: k) (b :: k) (p :: k -> k -> Type). (a ~> b) -> FreePromonad p a b | |
| Comp :: forall {k} (p :: k -> k -> Type) (a :: k) (b1 :: k) (b :: k). p a b1 -> FreePromonad p b1 b -> FreePromonad p a b |
Instances
| Profunctor p => Profunctor (FreePromonad p :: j -> j -> Type) Source Github # | |
Defined in Proarrow.Profunctor.Free Methods dimap :: forall (c :: j) (a :: j) (b :: j) (d :: j). (c ~> a) -> (b ~> d) -> FreePromonad p a b -> FreePromonad p c d Source Github # lmap :: forall (c :: j) (a :: j) (b :: j). (c ~> a) -> FreePromonad p a b -> FreePromonad p c b Source Github # rmap :: forall (b :: j) (d :: j) (a :: j). (b ~> d) -> FreePromonad p a b -> FreePromonad p a d Source Github # (\\) :: forall (a :: j) (b :: j) r. ((Ob a, Ob b) => r) -> FreePromonad p a b -> r Source Github # | |
| Profunctor p => Promonad (FreePromonad p :: k -> k -> Type) Source Github # | |
Defined in Proarrow.Profunctor.Free Methods id :: forall (a :: k). Ob a => FreePromonad p a a Source Github # (.) :: forall (b :: k) (c :: k) (a :: k). FreePromonad p b c -> FreePromonad p a b -> FreePromonad p a c Source Github # | |
| Functor (FreePromonad :: (k -> k -> Type) -> k -> k -> Type) Source Github # | |
Defined in Proarrow.Profunctor.Free Methods map :: forall (a :: k -> k -> Type) (b :: k -> k -> Type). (a ~> b) -> FreePromonad a ~> FreePromonad b Source Github # | |
| Promonad (Star (FreePromonad :: (k -> k -> Type) -> k -> k -> Type) :: (k -> k -> Type) -> (k -> k -> Type) -> Type) Source Github # | |
Defined in Proarrow.Profunctor.Free Methods id :: forall (a :: k -> k -> Type). Ob a => Star (FreePromonad :: (k -> k -> Type) -> k -> k -> Type) a a Source Github # (.) :: forall (b :: k -> k -> Type) (c :: k -> k -> Type) (a :: k -> k -> Type). Star (FreePromonad :: (k -> k -> Type) -> k -> k -> Type) b c -> Star (FreePromonad :: (k -> k -> Type) -> k -> k -> Type) a b -> Star (FreePromonad :: (k -> k -> Type) -> k -> k -> Type) a c Source Github # | |
freePromonadAlg :: forall {k} (p :: k +-> k) (a :: k) (b :: k). (p :.: FreePromonad p) a b -> FreePromonad p a b Source Github #
foldFreePromonad :: forall {k1} (q :: CAT k1) (p :: k1 -> k1 -> Type). Promonad q => (p :~> q) -> FreePromonad p :~> q Source Github #
type family FreeK (b :: Kind -> Constraint) (c :: Kind -> Constraint) k Source Github #
The free c-structured kind over a b-structured kind k. A standalone family (rather than
an associated type of HasFreeK) because the kinds of Lift and Retract mention it.
Instances
| type FreeK TracedMonoidal CompactClosed k Source Github # | |
Defined in Proarrow.Profunctor.Free | |
| type FreeK CategoryOf Monoidal k Source Github # | |
Defined in Proarrow.Profunctor.Free | |
| type FreeK CategoryOf HasBinaryProducts k Source Github # | The free category with binary products over |
Defined in Proarrow.Profunctor.Free | |
| type FreeK CategoryOf HasTerminalObject k Source Github # | The free category with a terminal object over |
Defined in Proarrow.Profunctor.Free | |
class c (FreeK b c k) => FreeK' (b :: Kind -> Constraint) (c :: Kind -> Constraint) k Source Github #
type family Lift (b :: Kind -> Constraint) (c :: Kind -> Constraint) (a :: k) :: FreeK b c k Source Github #
The embedding of an object of k into the free c-structured kind.
Instances
| type Lift TracedMonoidal CompactClosed (a :: k) Source Github # | |
Defined in Proarrow.Profunctor.Free | |
| type Lift CategoryOf Monoidal (a :: k) Source Github # | |
Defined in Proarrow.Profunctor.Free | |
| type Lift CategoryOf HasBinaryProducts (a :: k) Source Github # | |
Defined in Proarrow.Profunctor.Free type Lift CategoryOf HasBinaryProducts (a :: k) = 'EMB a :: FREE '[HasBinaryProducts] ((~>) :: CAT k) | |
| type Lift CategoryOf HasTerminalObject (a :: k) Source Github # | |
Defined in Proarrow.Profunctor.Free type Lift CategoryOf HasTerminalObject (a :: k) = 'EMB a :: FREE '[HasTerminalObject] ((~>) :: CAT k) | |
type family Retract (b :: Kind -> Constraint) (c :: Kind -> Constraint) k (a :: FreeK b c k) :: k Source Github #
Interpret an object of the free c-structured kind back into k.
Instances
| type Retract CategoryOf Monoidal k (a :: FreeK CategoryOf Monoidal k) Source Github # | |
Defined in Proarrow.Profunctor.Free type Retract CategoryOf Monoidal k (a :: FreeK CategoryOf Monoidal k) = Fold (UN ('L :: [k] -> LIST k) a) | |
| type Retract CategoryOf HasBinaryProducts k (a :: FreeK CategoryOf HasBinaryProducts k) Source Github # | |
Defined in Proarrow.Profunctor.Free type Retract CategoryOf HasBinaryProducts k (a :: FreeK CategoryOf HasBinaryProducts k) = Lower (Id :: k -> k -> Type) a | |
| type Retract CategoryOf HasTerminalObject k (a :: FreeK CategoryOf HasTerminalObject k) Source Github # | |
Defined in Proarrow.Profunctor.Free type Retract CategoryOf HasTerminalObject k (a :: FreeK CategoryOf HasTerminalObject k) = Lower (Id :: k -> k -> Type) a | |
| type Retract TracedMonoidal CompactClosed k ('I a b :: FreeK TracedMonoidal CompactClosed k) Source Github # | |
Defined in Proarrow.Profunctor.Free type Retract TracedMonoidal CompactClosed k ('I a b :: FreeK TracedMonoidal CompactClosed k) = a ** Dual b | |
class (forall k. b k => FreeK' b c k) => HasFreeK (b :: Kind -> Constraint) (c :: Kind -> Constraint) where Source Github #
builds the free FreeK b cc-structured kind over any b-structured kind: liftK
embeds the arrows of k, and when k itself is already c-structured retractK interprets
back into k.
Methods
liftK :: forall k (x :: k) (y :: k). b k => (x ~> y) -> Lift b c x ~> Lift b c y Source Github #
retractK :: forall k (x :: FreeK b c k) (y :: FreeK b c k). c k => (x ~> y) -> Retract b c k x ~> Retract b c k y Source Github #
Instances
| HasFreeK TracedMonoidal CompactClosed Source Github # | |
Defined in Proarrow.Profunctor.Free Methods liftK :: forall k (x :: k) (y :: k). TracedMonoidal k => (x ~> y) -> Lift TracedMonoidal CompactClosed x ~> Lift TracedMonoidal CompactClosed y Source Github # retractK :: forall k (x :: FreeK TracedMonoidal CompactClosed k) (y :: FreeK TracedMonoidal CompactClosed k). CompactClosed k => (x ~> y) -> Retract TracedMonoidal CompactClosed k x ~> Retract TracedMonoidal CompactClosed k y Source Github # | |
| HasFreeK CategoryOf Monoidal Source Github # | |
Defined in Proarrow.Profunctor.Free Methods liftK :: forall k (x :: k) (y :: k). CategoryOf k => (x ~> y) -> Lift CategoryOf Monoidal x ~> Lift CategoryOf Monoidal y Source Github # retractK :: forall k (x :: FreeK CategoryOf Monoidal k) (y :: FreeK CategoryOf Monoidal k). Monoidal k => (x ~> y) -> Retract CategoryOf Monoidal k x ~> Retract CategoryOf Monoidal k y Source Github # | |
| HasFreeK CategoryOf HasBinaryProducts Source Github # | |
Defined in Proarrow.Profunctor.Free Methods liftK :: forall k (x :: k) (y :: k). CategoryOf k => (x ~> y) -> Lift CategoryOf HasBinaryProducts x ~> Lift CategoryOf HasBinaryProducts y Source Github # retractK :: forall k (x :: FreeK CategoryOf HasBinaryProducts k) (y :: FreeK CategoryOf HasBinaryProducts k). HasBinaryProducts k => (x ~> y) -> Retract CategoryOf HasBinaryProducts k x ~> Retract CategoryOf HasBinaryProducts k y Source Github # | |
| HasFreeK CategoryOf HasTerminalObject Source Github # | |
Defined in Proarrow.Profunctor.Free Methods liftK :: forall k (x :: k) (y :: k). CategoryOf k => (x ~> y) -> Lift CategoryOf HasTerminalObject x ~> Lift CategoryOf HasTerminalObject y Source Github # retractK :: forall k (x :: FreeK CategoryOf HasTerminalObject k) (y :: FreeK CategoryOf HasTerminalObject k). HasTerminalObject k => (x ~> y) -> Retract CategoryOf HasTerminalObject k x ~> Retract CategoryOf HasTerminalObject k y Source Github # | |
Orphan instances
| HasFree ob => Corepresentable (Rep (Forget ob) :: k -> SUBCAT ob -> Type) Source Github # | By creating the left adjoint to the forgetful functor, we obtain the free-forgetful adjunction. |
Methods coindex :: forall (a :: k) (b :: SUBCAT ob). Rep (Forget ob) a b -> (Rep (Forget ob) %% a) ~> b Source Github # cotabulate :: forall (a :: k) (b :: SUBCAT ob). Ob a => ((Rep (Forget ob) %% a) ~> b) -> Rep (Forget ob) a b Source Github # corepMap :: forall (a :: k) (b :: k). (a ~> b) -> (Rep (Forget ob) %% a) ~> (Rep (Forget ob) %% b) Source Github # corepUniv :: forall (a :: k). Ob a => Rep (Forget ob) a (Rep (Forget ob) %% a) Source Github # | |