inf-backprop-0.1.0.0: Automatic differentiation and backpropagation.
Copyright(C) 2023 Alexey Tochin
LicenseBSD3 (see the file LICENSE)
MaintainerAlexey Tochin <Alexey.Tochin@gmail.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010
Extensions
  • MonoLocalBinds
  • ScopedTypeVariables
  • TypeFamilies
  • GADTs
  • GADTSyntax
  • ConstraintKinds
  • InstanceSigs
  • DeriveFunctor
  • TypeSynonymInstances
  • FlexibleContexts
  • FlexibleInstances
  • ConstrainedClassMethods
  • MultiParamTypeClasses
  • KindSignatures
  • TupleSections
  • RankNTypes
  • ExplicitNamespaces
  • ExplicitForAll

IsomorphismClass.Isomorphism

Description

Isomorphism class and instances.

Synopsis

Documentation

class Isomorphism (c :: Type -> Type -> Type) Source #

A generalization of isomorphism. Type argument c is usually a category.

Minimal complete definition

iso

Instances

Instances details
Monad m => Isomorphism (Kleisli m) Source #

Kleisli (monadic) instance of Isomorphism.

Examples of usage

Expand
>>> import Prelude (Int, fst, Either (Right))
>>> import Data.Void (Void)
>>> import Control.Arrow (runKleisli)
>>> import IsomorphismClass.Extra ()
>>> runKleisli (iso :: (Kleisli []) (a, b) (b, a)) (1, "x")
[("x",1)]
Instance details

Defined in IsomorphismClass.Isomorphism

Methods

iso :: IsomorphicTo a b => Kleisli m a b Source #

(Isomorphism cat, CatBiFunctor (,) cat) => Isomorphism (Backprop cat) Source # 
Instance details

Defined in InfBackprop.Common

Methods

iso :: IsomorphicTo a b => Backprop cat a b Source #

Comonad w => Isomorphism (Cokleisli w) Source #

Cokleisli (comonadic) instance of Isomorphism.

Examples of usage

Expand
>>> import Prelude (Int, fst, Either (Right), (+))
>>> import Data.Void (Void)
>>> import Control.Comonad (Cokleisli(Cokleisli), runCokleisli)
>>> import Control.Comonad.Store (store, runStore, Store)
>>> import IsomorphismClass.Extra ()
>>> runCokleisli (iso :: (Cokleisli (Store Int)) (a, b) (b, a)) (store (\x -> (x + 1, x + 2)) 0)
(2,1)
Instance details

Defined in IsomorphismClass.Isomorphism

Methods

iso :: IsomorphicTo a b => Cokleisli w a b Source #

Isomorphism (->) Source #

Trivial instance of Isomorphism that is the map type (->).

Examples of usage

Expand
>>> import Prelude (Int, fst, Either (Right))
>>> import Data.Void (Void)
>>> import IsomorphismClass.Extra ()
>>> (iso :: (->) (a, b) (b, a)) (1, "x")
("x",1)
>>> (iso :: (->) (a, ()) a) (42, ())
42
>>> (iso :: (->) (Either Void a) a) (Right 42)
42
Instance details

Defined in IsomorphismClass.Isomorphism

Methods

iso :: IsomorphicTo a b => a -> b Source #

iso :: (Isomorphism c, IsomorphicTo a b) => c a b Source #

Categorical morphism that that is related to an isomorphism map from a to b.