concat-examples-0.3.0.0: Some examples of compiling to categories
Safe HaskellSafe-Inferred
LanguageHaskell2010

ConCat.Dual

Description

Dual category for additive types. Use with GAD for efficient reverse mode AD.

Documentation

newtype Dual k a b Source #

Constructors

Dual (b `k` a) 

Instances

Instances details
CoerceCat k b a => CoerceCat (Dual k :: Type -> Type -> Type) (a :: Type) (b :: Type) Source # 
Instance details

Defined in ConCat.Dual

Methods

coerceC :: Dual k a b Source #

RepCat k a r => RepCat (Dual k :: Type -> Type -> Type) (a :: Type) (r :: Type) Source # 
Instance details

Defined in ConCat.Dual

Methods

reprC :: Dual k a r Source #

abstC :: Dual k r a Source #

(OkCAR (Dual k a b), IfCat (:>) (Rep (Dual k a b))) => IfCat (:>) (Dual k a b) Source # 
Instance details

Defined in ConCat.Dual

Methods

ifC :: IfT (:>) (Dual k a b) Source #

AssociativePCat k => AssociativePCat (Dual k) Source # 
Instance details

Defined in ConCat.Dual

Methods

lassocP :: Ok3 (Dual k) a b c => Dual k (Prod (Dual k) a (Prod (Dual k) b c)) (Prod (Dual k) (Prod (Dual k) a b) c) Source #

rassocP :: Ok3 (Dual k) a b c => Dual k (Prod (Dual k) (Prod (Dual k) a b) c) (Prod (Dual k) a (Prod (Dual k) b c)) Source #

BraidedPCat k => BraidedPCat (Dual k) Source # 
Instance details

Defined in ConCat.Dual

Methods

swapP :: Ok2 (Dual k) a b => Dual k (Prod (Dual k) a b) (Prod (Dual k) b a) Source #

Category k => Category (Dual k) Source # 
Instance details

Defined in ConCat.Dual

Associated Types

type Ok (Dual k) :: Type -> Constraint Source #

Methods

id :: Ok (Dual k) a => Dual k a a Source #

(.) :: forall b c a. Ok3 (Dual k) a b c => Dual k b c -> Dual k a b -> Dual k a c Source #

(BraidedPCat k, ProductCat k) => CoproductPCat (Dual k) Source # 
Instance details

Defined in ConCat.Dual

Methods

inlP :: Ok2 (Dual k) a b => Dual k a (CoprodP (Dual k) a b) Source #

inrP :: Ok2 (Dual k) a b => Dual k b (CoprodP (Dual k) a b) Source #

jamP :: Ok (Dual k) a => Dual k (CoprodP (Dual k) a a) a Source #

TerminalCat k => CoterminalCat (Dual k) Source # 
Instance details

Defined in ConCat.Dual

Methods

ti :: Ok (Dual k) a => Dual k (Counit (Dual k)) a Source #

MonoidalPCat k => MonoidalPCat (Dual k) Source # 
Instance details

Defined in ConCat.Dual

Methods

(***) :: Ok4 (Dual k) a b c d => Dual k a c -> Dual k b d -> Dual k (Prod (Dual k) a b) (Prod (Dual k) c d) Source #

first :: forall a a' b. Ok3 (Dual k) a b a' => Dual k a a' -> Dual k (Prod (Dual k) a b) (Prod (Dual k) a' b) Source #

second :: Ok3 (Dual k) a b b' => Dual k b b' -> Dual k (Prod (Dual k) a b) (Prod (Dual k) a b') Source #

CoproductPCat k => ProductCat (Dual k) Source # 
Instance details

Defined in ConCat.Dual

Methods

exl :: Ok2 (Dual k) a b => Dual k (Prod (Dual k) a b) a Source #

exr :: Ok2 (Dual k) a b => Dual k (Prod (Dual k) a b) b Source #

dup :: Ok (Dual k) a => Dual k a (Prod (Dual k) a a) Source #

CoterminalCat k => TerminalCat (Dual k) Source # 
Instance details

Defined in ConCat.Dual

Methods

it :: Ok (Dual k) a => Dual k a (Unit (Dual k)) Source #

UnitCat k => UnitCat (Dual k) Source # 
Instance details

Defined in ConCat.Dual

Methods

lunit :: Ok (Dual k) a => Dual k a (Prod (Dual k) (Unit (Dual k)) a) Source #

lcounit :: Ok (Dual k) a => Dual k (Prod (Dual k) (Unit (Dual k)) a) a Source #

runit :: Ok (Dual k) a => Dual k a (Prod (Dual k) a (Unit (Dual k))) Source #

rcounit :: Ok (Dual k) a => Dual k (Prod (Dual k) a (Unit (Dual k))) a Source #

(Category k, TerminalCat k, CoterminalCat k, Ok (Dual k) b) => ConstCat (Dual k) b Source # 
Instance details

Defined in ConCat.Dual

Methods

const :: Ok (Dual k) a => b -> Dual k a (ConstObj (Dual k) b) Source #

unitArrow :: b -> Dual k (Unit (Dual k)) (ConstObj (Dual k) b) Source #

(Functor h, ZipCat k h, Additive1 h, FunctorCat k h) => FunctorCat (Dual k) h Source # 
Instance details

Defined in ConCat.Dual

Methods

fmapC :: Ok2 (Dual k) a b => Dual k a b -> Dual k (h a) (h b) Source #

unzipC :: Ok2 (Dual k) a b => Dual k (h (a :* b)) (h a :* h b) Source #

(IxProductCat k h, Functor h, Additive1 h) => IxCoproductPCat (Dual k) h Source # 
Instance details

Defined in ConCat.Dual

Methods

inPF :: Ok (Dual k) a => h (Dual k a (h a)) Source #

joinPF :: Ok2 (Dual k) a b => h (Dual k b a) -> Dual k (h b) a Source #

jamPF :: Ok (Dual k) a => Dual k (h a) a Source #

(IxMonoidalPCat k h, Functor h, Additive1 h) => IxMonoidalPCat (Dual k) h Source # 
Instance details

Defined in ConCat.Dual

Methods

crossF :: Ok2 (Dual k) a b => h (Dual k a b) -> Dual k (h a) (h b) Source #

(IxCoproductPCat k h, Functor h, Additive1 h) => IxProductCat (Dual k) h Source # 
Instance details

Defined in ConCat.Dual

Methods

exF :: Ok (Dual k) a => h (Dual k (h a) a) Source #

forkF :: Ok2 (Dual k) a b => h (Dual k a b) -> Dual k a (h b) Source #

replF :: Ok (Dual k) a => Dual k a (h a) Source #

(OkFunctor k h, Additive1 h) => OkFunctor (Dual k) h Source # 
Instance details

Defined in ConCat.Dual

Methods

okFunctor :: Ok' (Dual k) a |- Ok' (Dual k) (h a) Source #

(OkIxProd k h, Additive1 h) => OkIxProd (Dual k) h Source # 
Instance details

Defined in ConCat.Dual

Methods

okIxProd :: Ok' (Dual k) a |- Ok' (Dual k) (h a) Source #

RepresentableCat k g => RepresentableCat (Dual k) g Source # 
Instance details

Defined in ConCat.Dual

Methods

tabulateC :: Ok (Dual k) a => Dual k (Rep g -> a) (g a) Source #

indexC :: Ok (Dual k) a => Dual k (g a) (Rep g -> a) Source #

ScalarCat k s => ScalarCat (Dual k) s Source # 
Instance details

Defined in ConCat.Dual

Methods

scale :: s -> Dual k s s Source #

(Zip h, ZapCat k h, OkF k h) => ZapCat (Dual k) h Source # 
Instance details

Defined in ConCat.Dual

Methods

zapC :: Ok2 (Dual k) a b => h (Dual k a b) -> Dual k (h a) (h b) Source #

(Zip h, Additive1 h, FunctorCat k h) => ZipCat (Dual k) h Source # 
Instance details

Defined in ConCat.Dual

Methods

zipC :: Ok2 (Dual k) a b => Dual k (h a :* h b) (h (a :* b)) Source #

(PointedCat k h a, Additive a) => AddCat (Dual k) h a Source # 
Instance details

Defined in ConCat.Dual

Methods

sumAC :: Dual k (h a) a Source #

DistributiveCat k f g => DistributiveCat (Dual k) g f Source # 
Instance details

Defined in ConCat.Dual

Methods

distributeC :: Ok (Dual k) a => Dual k (f (g a)) (g (f a)) Source #

(Additive a, Additive1 h, MinMaxFunctorCat (->) h a, PointedCat k h a) => MinMaxFFunctorCat (Dual k) h a Source # 
Instance details

Defined in ConCat.Dual

Methods

minimumCF :: h a -> a :* Dual k (h a) a Source #

maximumCF :: h a -> a :* Dual k (h a) a Source #

(AddCat k h a, Additive a, OkF k h) => PointedCat (Dual k) h a Source # 
Instance details

Defined in ConCat.Dual

Methods

pointC :: Dual k a (h a) Source #

TraversableCat k f t => TraversableCat (Dual k) t f Source # 
Instance details

Defined in ConCat.Dual

Methods

sequenceAC :: Ok (Dual k) a => Dual k (t (f a)) (f (t a)) Source #

HasRep (Dual k a b) Source # 
Instance details

Defined in ConCat.Dual

Associated Types

type Rep (Dual k a b) Source #

Methods

repr :: Dual k a b -> Rep (Dual k a b) Source #

abst :: Rep (Dual k a b) -> Dual k a b Source #

OkCAR (Dual k a b) => GenBuses (Dual k a b) Source # 
Instance details

Defined in ConCat.Dual

Methods

genBuses' :: Template u v -> [Source] -> BusesM (Buses (Dual k a b)) Source #

ty :: Ty Source #

unflattenB' :: State [Source] (Buses (Dual k a b)) Source #

type Ok (Dual k) Source # 
Instance details

Defined in ConCat.Dual

type Ok (Dual k) = Ok k &+& Additive
type Rep (Dual k a b) Source # 
Instance details

Defined in ConCat.Dual

type Rep (Dual k a b) = k b a

unDual :: Dual k a b -> b `k` a Source #

type OkF k h = (Additive1 h, OkFunctor k h) Source #

toDual :: forall k a b. (a -> b) -> b `k` a Source #