{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds, RankNTypes #-}
module OAlg.Hom.Oriented.Definition
(
HomOriented
, HomOrientedDisjunctive, omapDisj
, FunctorialOriented
, module V
, DualisableOriented
, toDualArw, toDualPnt, toDualOrt
, toDualOpOrt
)
where
import OAlg.Prelude
import OAlg.Category.Dualisable
import OAlg.Category.Path
import OAlg.Data.Variant as V
import OAlg.Structure.Oriented hiding (Path(..))
import OAlg.Hom.Definition
class ( Morphism h, Applicative h, ApplicativePoint h
, Transformable (ObjectClass h) Ort
) => HomOriented h where
instance HomOriented h => HomOriented (Path h)
instance TransformableOrt s => HomOriented (HomEmpty s)
instance HomOriented h => HomOriented (Id2 h)
instance TransformableOrt s => HomOriented (HomId s)
instance HomOriented h => HomOriented (Inv2 h)
omapDisj :: (ApplicativePoint h, Disjunctive2 h)
=> h x y -> Orientation (Point x) -> Orientation (Point y)
omapDisj :: forall (h :: * -> * -> *) x y.
(ApplicativePoint h, Disjunctive2 h) =>
h x y -> Orientation (Point x) -> Orientation (Point y)
omapDisj h x y
h = case h x y -> Variant
forall x y. h x y -> Variant
forall {k} {k1} (h :: k -> k1 -> *) (x :: k) (y :: k1).
Disjunctive2 h =>
h x y -> Variant
variant2 h x y
h of
Variant
Covariant -> h x y -> Orientation (Point x) -> Orientation (Point y)
forall (h :: * -> * -> *) a b.
ApplicativePoint h =>
h a b -> Orientation (Point a) -> Orientation (Point b)
omap h x y
h
Variant
Contravariant -> Orientation (Point y) -> Orientation (Point y)
forall p. Orientation p -> Orientation p
opposite (Orientation (Point y) -> Orientation (Point y))
-> (Orientation (Point x) -> Orientation (Point y))
-> Orientation (Point x)
-> Orientation (Point y)
forall y z x. (y -> z) -> (x -> y) -> x -> z
forall (c :: * -> * -> *) y z x.
Category c =>
c y z -> c x y -> c x z
. h x y -> Orientation (Point x) -> Orientation (Point y)
forall (h :: * -> * -> *) a b.
ApplicativePoint h =>
h a b -> Orientation (Point a) -> Orientation (Point b)
omap h x y
h
class ( Morphism h, Applicative h, ApplicativePoint h
, Transformable (ObjectClass h) Ort
, Disjunctive2 h
)
=> HomOrientedDisjunctive h
instance HomOrientedDisjunctive h => HomOrientedDisjunctive (Path h)
instance
( CategoryDisjunctive h
, HomOrientedDisjunctive h
)
=> HomOrientedDisjunctive (Inv2 h)
instance HomOrientedDisjunctive h => HomOriented (Variant2 Covariant h)
instance
( Transformable s Ort
, HomOrientedDisjunctive h
)
=> HomOrientedDisjunctive (Sub s h)
class (DualisableG s (->) o Id, DualisableG s (->) o Pnt, Transformable s Ort)
=> DualisableOriented s o
instance (TransformableType s, TransformableOrt s, TransformableOp s) => DualisableOriented s Op
toDualArw :: DualisableOriented s o => q o -> Struct s x -> x -> o x
toDualArw :: forall s (o :: * -> *) (q :: (* -> *) -> *) x.
DualisableOriented s o =>
q o -> Struct s x -> x -> o x
toDualArw q o
_ Struct s x
s = (Id x -> Id (o x)) -> x -> o x
forall x y. (Id x -> Id y) -> x -> y
fromIdG (DualityG s (->) o Id -> Struct s x -> Id x -> Id (o x)
forall r (c :: * -> * -> *) (o :: * -> *) (d :: * -> *)
(q :: (* -> * -> *) -> (* -> *) -> (* -> *) -> *) x.
DualisableG r c o d =>
q c o d -> Struct r x -> c (d x) (d (o x))
toDualG' (Struct s x -> DualityG s (->) o Id
forall s (o :: * -> *) x.
DualisableOriented s o =>
Struct s x -> DualityG s (->) o Id
d Struct s x
s) Struct s x
s) where
d :: DualisableOriented s o => Struct s x -> DualityG s (->) o Id
d :: forall s (o :: * -> *) x.
DualisableOriented s o =>
Struct s x -> DualityG s (->) o Id
d Struct s x
_ = DualityG s (->) o Id
forall r (c :: * -> * -> *) (o :: * -> *) (d :: * -> *).
DualisableG r c o d =>
DualityG r c o d
DualityG
toDualPnt :: DualisableOriented s o => q o -> Struct s x -> Point x -> Point (o x)
toDualPnt :: forall s (o :: * -> *) (q :: (* -> *) -> *) x.
DualisableOriented s o =>
q o -> Struct s x -> Point x -> Point (o x)
toDualPnt q o
q Struct s x
s = (Pnt x -> Pnt (o x)) -> Point x -> Point (o x)
forall x y. (Pnt x -> Pnt y) -> Point x -> Point y
fromPntG (DualityG s (->) o Pnt -> Struct s x -> Pnt x -> Pnt (o x)
forall r (c :: * -> * -> *) (o :: * -> *) (d :: * -> *)
(q :: (* -> * -> *) -> (* -> *) -> (* -> *) -> *) x.
DualisableG r c o d =>
q c o d -> Struct r x -> c (d x) (d (o x))
toDualG' (q o -> Struct s x -> DualityG s (->) o Pnt
forall s (o :: * -> *) (q :: (* -> *) -> *) x.
DualisableOriented s o =>
q o -> Struct s x -> DualityG s (->) o Pnt
d q o
q Struct s x
s) Struct s x
s) where
d :: DualisableOriented s o => q o -> Struct s x -> DualityG s (->) o Pnt
d :: forall s (o :: * -> *) (q :: (* -> *) -> *) x.
DualisableOriented s o =>
q o -> Struct s x -> DualityG s (->) o Pnt
d q o
_ Struct s x
_ = DualityG s (->) o Pnt
forall r (c :: * -> * -> *) (o :: * -> *) (d :: * -> *).
DualisableG r c o d =>
DualityG r c o d
DualityG
toDualOrt :: DualisableOriented s o => q o -> Struct s x
-> Orientation (Point x) -> Orientation (Point (o x))
toDualOrt :: forall s (o :: * -> *) (q :: (* -> *) -> *) x.
DualisableOriented s o =>
q o
-> Struct s x -> Orientation (Point x) -> Orientation (Point (o x))
toDualOrt q o
q Struct s x
st (Point x
s :> Point x
e) = Orientation (Point (o x)) -> Orientation (Point (o x))
forall p. Orientation p -> Orientation p
opposite (Point x -> Point (o x)
t Point x
s Point (o x) -> Point (o x) -> Orientation (Point (o x))
forall p. p -> p -> Orientation p
:> Point x -> Point (o x)
t Point x
e) where t :: Point x -> Point (o x)
t = q o -> Struct s x -> Point x -> Point (o x)
forall s (o :: * -> *) (q :: (* -> *) -> *) x.
DualisableOriented s o =>
q o -> Struct s x -> Point x -> Point (o x)
toDualPnt q o
q Struct s x
st
instance (HomOriented h, DualisableOriented s o) => HomOrientedDisjunctive (HomDisj s o h)
class (Functorial h, FunctorialPoint h) => FunctorialOriented h
instance FunctorialOriented h => FunctorialOriented (Inv2 h)
instance (HomOriented h, DualisableOriented s o) => FunctorialOriented (HomDisj s o h)
toDualOpOrt :: Oriented x => Variant2 Contravariant (IsoO Ort Op) x (Op x)
toDualOpOrt :: forall x.
Oriented x =>
Variant2 'Contravariant (IsoO Ort Op) x (Op x)
toDualOpOrt = Struct Ort x -> Variant2 'Contravariant (IsoO Ort Op) x (Op x)
forall (o :: * -> *) r x.
TransformableGRefl o r =>
Struct r x -> Variant2 'Contravariant (IsoO r o) x (o x)
toDualO Struct Ort x
forall s x. Structure s x => Struct s x
Struct