{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ConstraintKinds #-}
module OAlg.Category.NaturalTransformable
(
NaturalTransformable
, NaturalTransformation(..), roh'
, NaturalFunctorial
, Natural(..)
, NaturalTransformableDual1
, prpNaturalTransformable, SomeNaturalApplication(..)
, relNaturalTransformable
) where
import OAlg.Prelude
class Natural s b f g where
roh :: Struct s x -> b (f x) (g x)
class
( Natural (ObjectClass a) b f g
, FunctorialG f a b, FunctorialG g a b
)
=> NaturalTransformable a b f g
data NaturalTransformation a b f g where
NaturalTransformation :: NaturalTransformable a b f g => NaturalTransformation a b f g
type NaturalFunctorial a b f g
= ( NaturalTransformable a b f g
, FunctorialG f a b, FunctorialG g a b
)
class NaturalTransformable h b (Dual1 f) (Dual1 g)
=> NaturalTransformableDual1 h b f g
roh' :: NaturalTransformation a b f g -> Struct (ObjectClass a) x -> b (f x) (g x)
roh' :: forall (a :: * -> * -> *) (b :: * -> * -> *) (f :: * -> *)
(g :: * -> *) x.
NaturalTransformation a b f g
-> Struct (ObjectClass a) x -> b (f x) (g x)
roh' NaturalTransformation a b f g
NaturalTransformation = Struct (ObjectClass a) x -> b (f x) (g x)
forall x. Struct (ObjectClass a) x -> b (f x) (g x)
forall s (b :: * -> * -> *) (f :: * -> *) (g :: * -> *) x.
Natural s b f g =>
Struct s x -> b (f x) (g x)
roh
data SomeNaturalApplication a f g where
SomeNaturalApplication
:: (Show2 a, Eq (g y), Show (f x))
=> a x y -> f x -> SomeNaturalApplication a f g
relNaturalTransformable :: (Show2 a, Eq (g y), Show (f x))
=> NaturalTransformation a (->) f g -> a x y -> f x -> Statement
relNaturalTransformable :: forall (a :: * -> * -> *) (g :: * -> *) y (f :: * -> *) x.
(Show2 a, Eq (g y), Show (f x)) =>
NaturalTransformation a (->) f g -> a x y -> f x -> Statement
relNaturalTransformable n :: NaturalTransformation a (->) f g
n@NaturalTransformation a (->) f g
NaturalTransformation a x y
a f x
f
= ((a x y -> g x -> g y
forall (h :: * -> * -> *) (f :: * -> *) x y.
Applicative1 h f =>
h x y -> f x -> f y
amap1 a x y
a (g x -> g y) -> g x -> g y
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ NaturalTransformation a (->) f g
-> Struct (ObjectClass a) x -> f x -> g x
forall (a :: * -> * -> *) (b :: * -> * -> *) (f :: * -> *)
(g :: * -> *) x.
NaturalTransformation a b f g
-> Struct (ObjectClass a) x -> b (f x) (g x)
roh' NaturalTransformation a (->) f g
n (a x y -> Struct (ObjectClass a) x
forall x y. a x y -> Struct (ObjectClass a) x
forall (m :: * -> * -> *) x y.
Morphism m =>
m x y -> Struct (ObjectClass m) x
domain a x y
a) f x
f) g y -> g y -> Bool
forall a. Eq a => a -> a -> Bool
== (NaturalTransformation a (->) f g
-> Struct (ObjectClass a) y -> f y -> g y
forall (a :: * -> * -> *) (b :: * -> * -> *) (f :: * -> *)
(g :: * -> *) x.
NaturalTransformation a b f g
-> Struct (ObjectClass a) x -> b (f x) (g x)
roh' NaturalTransformation a (->) f g
n (a x y -> Struct (ObjectClass a) y
forall x y. a x y -> Struct (ObjectClass a) y
forall (m :: * -> * -> *) x y.
Morphism m =>
m x y -> Struct (ObjectClass m) y
range a x y
a) (f y -> g y) -> f y -> g y
forall (h :: * -> * -> *) x y. Applicative h => h x y -> x -> y
$ a x y -> f x -> f y
forall (h :: * -> * -> *) (f :: * -> *) x y.
Applicative1 h f =>
h x y -> f x -> f y
amap1 a x y
a f x
f))
Bool -> Message -> Statement
:?> [Parameter] -> Message
Params [String
"a"String -> String -> Parameter
:=a x y -> String
forall a b. a a b -> String
forall (h :: * -> * -> *) a b. Show2 h => h a b -> String
show2 a x y
a,String
"f x"String -> String -> Parameter
:=f x -> String
forall a. Show a => a -> String
show f x
f]
prpNaturalTransformable :: NaturalTransformation a (->) f g
-> X (SomeNaturalApplication a f g) -> Statement
prpNaturalTransformable :: forall (a :: * -> * -> *) (f :: * -> *) (g :: * -> *).
NaturalTransformation a (->) f g
-> X (SomeNaturalApplication a f g) -> Statement
prpNaturalTransformable NaturalTransformation a (->) f g
n X (SomeNaturalApplication a f g)
xsa = String -> Label
Prp String
"NaturalTransformable" Label -> Statement -> Statement
:<=>:
X (SomeNaturalApplication a f g)
-> (SomeNaturalApplication a f g -> Statement) -> Statement
forall x. X x -> (x -> Statement) -> Statement
Forall X (SomeNaturalApplication a f g)
xsa (\(SomeNaturalApplication a x y
a f x
f) -> NaturalTransformation a (->) f g -> a x y -> f x -> Statement
forall (a :: * -> * -> *) (g :: * -> *) y (f :: * -> *) x.
(Show2 a, Eq (g y), Show (f x)) =>
NaturalTransformation a (->) f g -> a x y -> f x -> Statement
relNaturalTransformable NaturalTransformation a (->) f g
n a x y
a f x
f)