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:
parent
559f9fb404
commit
df0d3e4528
@ -17,3 +17,4 @@
|
||||
- free arrows (concrete and condensity transformed)
|
||||
|
||||
## Unreleased changes
|
||||
- hoistOp
|
||||
|
@ -31,7 +31,7 @@ module Control.Category.Free
|
||||
, fromC
|
||||
-- * Oposite category
|
||||
, Op (..)
|
||||
|
||||
, hoistOp
|
||||
-- * Free interface re-exports
|
||||
, FreeAlgebra2 (..)
|
||||
, wrapFree2
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user