1
1
mirror of https://github.com/coot/free-category.git synced 2024-09-11 14:17:30 +03:00

hoistOp - Op is an endo-functor of category of categories

This commit is contained in:
Marcin Szamotulski 2019-08-31 14:03:38 +02:00
parent 559f9fb404
commit df0d3e4528
3 changed files with 13 additions and 1 deletions

View File

@ -17,3 +17,4 @@
- free arrows (concrete and condensity transformed)
## Unreleased changes
- hoistOp

View File

@ -31,7 +31,7 @@ module Control.Category.Free
, fromC
-- * Oposite category
, Op (..)
, hoistOp
-- * Free interface re-exports
, FreeAlgebra2 (..)
, wrapFree2

View File

@ -23,6 +23,7 @@
--
module Control.Category.Free.Internal
( Op (..)
, hoistOp
, ListTr (..)
, Queue (NilQ, ConsQ)
, emptyQ
@ -53,6 +54,16 @@ import Control.Algebra.Free2 ( AlgebraType0
--
newtype Op (f :: k -> k -> *) (a :: k) (b :: k) = Op { runOp :: f b a }
-- | 'Op' is an endo-functor of the category of categories.
--
hoistOp :: forall (f :: k -> k -> *)
(g :: k -> k -> *)
a b.
(forall x y. f x y -> g x y)
-> Op f a b
-> Op g a b
hoistOp nat (Op ba) = Op (nat ba)
instance Category f => Category (Op f) where
id = Op id
Op f . Op g = Op (g . f)