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

ConCat.GAD

Description

Generalized automatic differentiation

Synopsis

Documentation

newtype GD k a b Source #

Constructors

D 

Fields

  • unD :: a -> b :* (a `k` b)
     

Instances

Instances details
(Num s, Additive s, Atomic s) => NumCat Inc s Source # 
Instance details

Defined in ConCat.Incremental

Methods

negateC :: Inc s s Source #

addC :: Inc (Prod Inc s s) s Source #

subC :: Inc (Prod Inc s s) s Source #

mulC :: Inc (Prod Inc s s) s Source #

powIC :: Inc (Prod Inc s Int) s Source #

(CoerceCat (->) a b, CoerceCat k a b) => CoerceCat (GD k :: Type -> Type -> Type) (a :: Type) (b :: Type) Source # 
Instance details

Defined in ConCat.GAD

Methods

coerceC :: GD k a b Source #

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

Defined in ConCat.GAD

Methods

reprC :: GD k a r Source #

abstC :: GD k r a Source #

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

Defined in ConCat.GAD

Methods

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

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

Defined in ConCat.GAD

Methods

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

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

(ProductCat k, ConstCat k Bool, Ok k Bool) => BoolCat (GD k) Source # 
Instance details

Defined in ConCat.GAD

Methods

notC :: GD k (BoolOf (GD k)) (BoolOf (GD k)) Source #

andC :: GD k (Prod (GD k) (BoolOf (GD k)) (BoolOf (GD k))) (BoolOf (GD k)) Source #

orC :: GD k (Prod (GD k) (BoolOf (GD k)) (BoolOf (GD k))) (BoolOf (GD k)) Source #

xorC :: GD k (Prod (GD k) (BoolOf (GD k)) (BoolOf (GD k))) (BoolOf (GD k)) Source #

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

Defined in ConCat.GAD

Methods

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

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

Defined in ConCat.GAD

Associated Types

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

Methods

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

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

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

Defined in ConCat.GAD

Methods

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

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

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

OkAdd k => OkAdd (GD k) Source # 
Instance details

Defined in ConCat.GAD

Methods

okAdd :: Ok' (GD k) a |- Sat Additive a Source #

ProductCat k => ProductCat (GD k) Source # 
Instance details

Defined in ConCat.GAD

Methods

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

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

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

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

Defined in ConCat.GAD

Methods

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

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

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

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

(TerminalCat k, CoterminalCat k, ConstCat k b, Additive b) => ConstCat (GD k) b Source # 
Instance details

Defined in ConCat.GAD

Methods

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

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

(ProductCat k, ConstCat k Bool, Eq a, Ok2 k a Bool) => EqCat (GD k) a Source # 
Instance details

Defined in ConCat.GAD

Methods

equal :: GD k (Prod (GD k) a a) (BoolOf (GD k)) Source #

notEqual :: GD k (Prod (GD k) a a) (BoolOf (GD k)) Source #

(ScalarCat k s, Ok k s, Floating s) => FloatingCat (GD k) s Source # 
Instance details

Defined in ConCat.GAD

Methods

expC :: GD k s s Source #

logC :: GD k s s Source #

cosC :: GD k s s Source #

sinC :: GD k s s Source #

sqrtC :: GD k s s Source #

tanhC :: GD k s s Source #

(LinearCat k s, Additive s, Fractional s) => FractionalCat (GD k) s Source # 
Instance details

Defined in ConCat.GAD

Methods

recipC :: GD k s s Source #

divideC :: GD k (Prod (GD k) s s) s Source #

(IxProductCat k h, Functor h, FunctorCat k h) => FunctorCat (GD k) h Source # 
Instance details

Defined in ConCat.GAD

Methods

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

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

(ProductCat k, ConstCat k Bool, Ok2 k Bool a) => IfCat (GD k) a Source # 
Instance details

Defined in ConCat.GAD

Methods

ifC :: IfT (GD k) a Source #

(IxMonoidalPCat (->) h, IxMonoidalPCat k h, Zip h) => IxMonoidalPCat (GD k) h Source # 
Instance details

Defined in ConCat.GAD

Methods

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

(IxProductCat (->) h, IxProductCat k h, Zip h) => IxProductCat (GD k) h Source # 
Instance details

Defined in ConCat.GAD

Methods

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

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

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

(ProductCat k, Ok k a, Ord a) => MinMaxCat (GD k) a Source # 
Instance details

Defined in ConCat.GAD

Methods

minC :: GD k (Prod (GD k) a a) a Source #

maxC :: GD k (Prod (GD k) a a) a Source #

(LinearCat k s, Additive s, Num s) => NumCat (GD k) s Source # 
Instance details

Defined in ConCat.GAD

Methods

negateC :: GD k s s Source #

addC :: GD k (Prod (GD k) s s) s Source #

subC :: GD k (Prod (GD k) s s) s Source #

mulC :: GD k (Prod (GD k) s s) s Source #

powIC :: GD k (Prod (GD k) s Int) s Source #

OkFunctor k h => OkFunctor (GD k) h Source # 
Instance details

Defined in ConCat.GAD

Methods

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

OkIxProd k h => OkIxProd (GD k) h Source # 
Instance details

Defined in ConCat.GAD

Methods

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

(ProductCat k, ConstCat k Bool, Ord a, Ok2 k a Bool) => OrdCat (GD k) a Source # 
Instance details

Defined in ConCat.GAD

Methods

lessThan :: GD k (Prod (GD k) a a) (BoolOf (GD k)) Source #

greaterThan :: GD k (Prod (GD k) a a) (BoolOf (GD k)) Source #

lessThanOrEqual :: GD k (Prod (GD k) a a) (BoolOf (GD k)) Source #

greaterThanOrEqual :: GD k (Prod (GD k) a a) (BoolOf (GD k)) Source #

(RepresentableCat (->) g, RepresentableCat k g) => RepresentableCat (GD k) g Source # 
Instance details

Defined in ConCat.GAD

Methods

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

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

(ZapCat k h, OkFunctor k h, Zip h) => ZapCat (GD k) h Source # 
Instance details

Defined in ConCat.GAD

Methods

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

(ZipCat k h, OkFunctor (GD k) h) => ZipCat (GD k) h Source # 
Instance details

Defined in ConCat.GAD

Methods

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

(AddCat (->) h a, AddCat k h a, OkFunctor (GD k) h) => AddCat (GD k) h a Source # 
Instance details

Defined in ConCat.GAD

Methods

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

(DistributiveCat (->) g f, DistributiveCat k g f) => DistributiveCat (GD k) g f Source # 
Instance details

Defined in ConCat.GAD

Methods

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

(ProductCat k, MinMaxFFunctorCat k h a, Ord a) => MinMaxFunctorCat (GD k) h a Source # 
Instance details

Defined in ConCat.GAD

Methods

minimumC :: GD k (h a) a Source #

maximumC :: GD k (h a) a Source #

(OkFunctor (GD k) h, Pointed h, PointedCat k h a) => PointedCat (GD k) h a Source # 
Instance details

Defined in ConCat.GAD

Methods

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

(TraversableCat (->) t f, TraversableCat k t f) => TraversableCat (GD k) t f Source # 
Instance details

Defined in ConCat.GAD

Methods

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

HasRep (GD k a b) Source # 
Instance details

Defined in ConCat.GAD

Associated Types

type Rep (GD k a b) Source #

Methods

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

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

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

Defined in ConCat.GAD

Methods

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

ty :: Ty Source #

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

type Ok (GD k) Source # 
Instance details

Defined in ConCat.GAD

type Ok (GD k) = Ok k
type Rep (GD k a b) Source # 
Instance details

Defined in ConCat.GAD

type Rep (GD k a b) = a -> b :* k a b

mkD :: HasRep (a `k` b) => (a -> b :* Rep (a `k` b)) -> GD k a b Source #

unMkD :: HasRep (a `k` b) => GD k a b -> a -> b :* Rep (a `k` b) Source #

linearD :: (a -> b) -> (a `k` b) -> GD k a b Source #

scalarD :: ScalarCat k s => (s -> s) -> (s -> s -> s) -> GD k s s Source #

scalarR :: ScalarCat k s => (s -> s) -> (s -> s) -> GD k s s Source #

scalarX :: ScalarCat k s => (s -> s) -> (s -> s) -> GD k s s Source #

discreteD :: (ConstCat k b, Ok k a, Additive b) => (a -> b) -> GD k a b Source #

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

A function combined with its derivative

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

The derivative of a given function