proarrow
Safe HaskellNone
LanguageGHC2024

Proarrow.Profunctor.Free

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

Documentation

class (CategoryOf k, forall (a :: k). Ob a => ob (Free ob a)) => HasFree (ob :: OB k) where Source Github #

Associated Types

type Free (ob :: OB k) (a :: k) :: k 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

Instances details
HasFree Monoid Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

Associated Types

type Free Monoid (a :: Type) 
Instance details

Defined in Proarrow.Profunctor.Free

type Free Monoid (a :: Type) = [a]

Methods

lift :: Ob a => a ~> Free Monoid a Source Github #

foldMap :: Monoid b => (a ~> b) -> Free Monoid a ~> b Source Github #

HasFree Semigroup Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

Associated Types

type Free Semigroup (a :: Type) 
Instance details

Defined in Proarrow.Profunctor.Free

type Free Semigroup (a :: Type) = NonEmpty a

Methods

lift :: Ob a => a ~> Free Semigroup a Source Github #

foldMap :: Semigroup b => (a ~> b) -> Free Semigroup a ~> b Source Github #

HasFree (Promonad :: CAT k -> Constraint) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

Methods

lift :: forall (a :: CAT k). Ob a => a ~> Free (Promonad :: CAT k -> Constraint) a Source Github #

foldMap :: forall (b :: CAT k) (a :: CAT k). Promonad b => (a ~> b) -> Free (Promonad :: CAT k -> Constraint) a ~> b Source Github #

HasFree (Profunctor :: (j +-> k) -> Constraint) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Instance.Coyoneda

Methods

lift :: forall (a :: j +-> k). Ob a => a ~> Free (Profunctor :: (j +-> k) -> Constraint) a Source Github #

foldMap :: forall (b :: j +-> k) (a :: j +-> k). Profunctor b => (a ~> b) -> Free (Profunctor :: (j +-> k) -> Constraint) a ~> b Source Github #

Monoidal k => HasFree (Applicative :: (k -> Type) -> Constraint) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

Methods

lift :: forall (a :: k -> Type). Ob a => a ~> Free (Applicative :: (k -> Type) -> Constraint) a Source Github #

foldMap :: forall (b :: k -> Type) (a :: k -> Type). Applicative b => (a ~> b) -> Free (Applicative :: (k -> Type) -> Constraint) a ~> b Source Github #

HasFree (On Monoid Semigroup) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

Associated Types

type Free (On Monoid Semigroup) ('SUB a :: SUBCAT Semigroup) 
Instance details

Defined in Proarrow.Profunctor.Free

Methods

lift :: forall (a :: SUBCAT Semigroup). Ob a => a ~> Free (On Monoid Semigroup) a Source Github #

foldMap :: forall (b :: SUBCAT Semigroup) (a :: SUBCAT Semigroup). On Monoid Semigroup b => (a ~> b) -> Free (On Monoid Semigroup) a ~> b Source Github #

Flavor w => HasFree (Prostrong w :: (j +-> k) -> Constraint) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Instance.PastroTambara

Methods

lift :: forall (a :: j +-> k). Ob a => a ~> Free (Prostrong w) a Source Github #

foldMap :: forall (b :: j +-> k) (a :: j +-> k). Prostrong w b => (a ~> b) -> Free (Prostrong w) a ~> b Source Github #

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

Instances details
(Monoidal k, Functor f) => Applicative (Ap f :: k -> Type) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

Methods

pure :: forall (a :: k). ((Unit :: k) ~> a) -> (Unit :: Type) ~> Ap f a Source Github #

liftA2 :: forall (a :: k) (b :: k) (c :: k). (Ob a, Ob b) => ((a ** b) ~> c) -> (Ap f a ** Ap f b) ~> Ap f c Source Github #

(CategoryOf k, Functor f) => Functor (Ap f :: k -> Type) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

Methods

map :: forall (a :: k) (b :: k). (a ~> b) -> Ap f a ~> Ap f b Source Github #

Functor (Ap :: (k -> Type) -> k -> Type) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

Methods

map :: forall (a :: k -> Type) (b :: k -> Type). (a ~> b) -> Ap a ~> Ap b Source Github #

Monoidal k => Promonad (Star (Ap :: (k -> Type) -> k -> Type) :: (k -> Type) -> (k -> Type) -> Type) Source Github # 
Instance details

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 # 
Instance details

Defined in Proarrow.Profunctor.Free

Methods

mempty :: Ap f m Github #

mappend :: Ap f m -> Ap f m -> Ap f m Github #

mconcat :: [Ap f m] -> Ap f m Github #

(Monoidal k, Monoid m) => Semigroup (Ap f m) Source Github #

Given as Semigroup/Monoid rather than as Monoid directly: Ap f m is of kind Type, where Monoid already comes from the blanket Monoid m => Monoid (m :: Type) instance, so defining it here too would make every use overlap and solve to neither.

Instance details

Defined in Proarrow.Profunctor.Free

Methods

(<>) :: Ap f m -> Ap f m -> Ap f m Github #

sconcat :: NonEmpty (Ap f m) -> Ap f m Github #

stimes :: Integral b => b -> Ap f m -> Ap f m Github #

retractAp :: forall {k} f (a :: k). Applicative f => Ap f a -> f a Source Github #

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

Instances details
Profunctor p => Profunctor (FreePromonad p :: j -> j -> Type) Source Github # 
Instance details

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 # 
Instance details

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 # 
Instance details

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 # 
Instance details

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

Instances details
type FreeK TracedMonoidal CompactClosed k Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

type FreeK CategoryOf Monoidal k Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

type FreeK CategoryOf HasBinaryProducts k Source Github #

The free category with binary products over k, built with Proarrow.Category.Instance.Free.

Instance details

Defined in Proarrow.Profunctor.Free

type FreeK CategoryOf HasTerminalObject k Source Github #

The free category with a terminal object over k, built with Proarrow.Category.Instance.Free.

Instance details

Defined in Proarrow.Profunctor.Free

class c (FreeK b c k) => FreeK' (b :: Kind -> Constraint) (c :: Kind -> Constraint) k Source Github #

Ob'-style helper: the quantified superclass of HasFreeK needs to state c (FreeK b c k), and a type family application cannot head a quantified constraint directly.

Instances

Instances details
c (FreeK b c k) => FreeK' b c k Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

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

Instances details
type Lift TracedMonoidal CompactClosed (a :: k) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

type Lift TracedMonoidal CompactClosed (a :: k) = 'I a (Unit :: k)
type Lift CategoryOf Monoidal (a :: k) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

type Lift CategoryOf Monoidal (a :: k) = 'L '[a]
type Lift CategoryOf HasBinaryProducts (a :: k) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

type Lift CategoryOf HasTerminalObject (a :: k) Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

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.

class (forall k. b k => FreeK' b c k) => HasFreeK (b :: Kind -> Constraint) (c :: Kind -> Constraint) where Source Github #

FreeK b c builds the free c-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

Instances details
HasFreeK TracedMonoidal CompactClosed Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

HasFreeK CategoryOf Monoidal Source Github # 
Instance details

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 # 
Instance details

Defined in Proarrow.Profunctor.Free

HasFreeK CategoryOf HasTerminalObject Source Github # 
Instance details

Defined in Proarrow.Profunctor.Free

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.

Instance details

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 #