dualizer-0.1.0.1: Automatically generate dual constructions.

Safe HaskellNone
LanguageHaskell2010

Categorical.Dual.Example

Description

This should be tests, but if you look for the source of this module, you’ll see how to use the package.

Synopsis

Documentation

class Functor f => Coapplicative (f :: Type -> Type) where Source #

This should get mapped to the newly created class … right?

Methods

extract :: forall (a :: Type). f a -> a Source #

class Coapplicative m => Comonad (m :: Type -> Type) where Source #

This should get mapped to the newly created class … right?

Methods

(=>>) :: forall (a :: Type) (b :: Type). m a -> m b -> m b -> a Source #

class (Functor t, Functor t) => Distributive (t :: Type -> Type) where Source #

Because Foldable is semi-dual to Functor (which isn’t safe), we end up with a duplicate Functor constraint here.

Methods

cotraverse :: forall (f :: Type -> Type) (a :: Type) (b :: Type). Coapplicative f => (f b -> a) -> f (t b) -> t a Source #

distribute :: forall (f :: Type -> Type) (a :: Type). Coapplicative f => f (t a) -> t (f a) Source #

consume :: (Traversable g, Applicative f) => (g b -> a) -> g (f b) -> f a Source #

type Algebra f a = f a -> a Source #

Sometimes the doc is mapped to the original.

type Coalgebra f a = a -> f a Source #

type GAlgebra w f a = f (w a) -> a Source #

Other times, to the dual.

type GCoalgebra w f a = a -> f (w a) Source #

type ElgotAlgebra w f a = w (f a) -> a Source #

I’m not sure why one or the other happens.

type ElgotCoalgebra w f a = a -> w (f a) Source #

newtype NewEither a b Source #

Constructors

NewEither (Either a b) 

newtype NewTuple a b Source #

Constructors

NewTuple ((,) a b) 

data NewEither' a b Source #

Constructors

NewEither' (Either a b) 

data NewTuple' a b Source #

Constructors

NewTuple' ((,) a b) 

data family TestA a Source #

I wonder if

data family DualA a Source #

type family TestB a Source #

This always

type family DualB a Source #

type family TestC a where ... Source #

Happens.

Equations

TestC (Either b c) = b 
TestC Int = Char 

type family DualC a where ... Source #

Equations

DualC ((,) b c) = b 
DualC Int = Char 

(>^>) :: (a -> b) -> (b -> c) -> a -> c Source #

(<^<) :: (b -> a) -> (c -> b) -> c -> a Source #

These docs are going to end up on <^<, which is not what I’d expect.

data Mu f Source #

Constructors

Mu (forall a. Algebra f a -> a) 

data Nu f where Source #

Constructors

Nu :: Coalgebra f a -> a -> Nu f 

data Fix f Source #

Constructors

Fix 

Fields

cata :: Functor f => (f a -> a) -> Fix f -> a Source #

ana :: Functor f => (a -> f a) -> a -> Fix f Source #

Interestingly, the documentation for a dualized function definition is added to the dual, not the explicitly-defined name. I don’t know why this behaves differently than the other cases.

exampleDuals :: Q DualMappings Source #

Duals for this module.