linear-1.3.1.1: Linear Algebra

Portabilitynon-portable
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe-Inferred

Linear.Core

Description

Corepresentable functors as vector spaces

Synopsis

Documentation

class Functor f => Core f whereSource

A Functor f is corepresentable if it is isomorphic to (x -> a) for some x. Nearly all such functors can be represented by choosing x to be the set of lenses that are polymorphic in the contents of the Functor, that is to say x = Rep f is a valid choice of x for (nearly) every Representable Functor.

Methods

core :: ((forall g x. Functor g => (x -> g x) -> f x -> g (f x)) -> a) -> f aSource

Form a structure by applying the given function to lenses focused on its holes.

 core :: ((forall x. Lens (f x) x) -> a) -> f a

Instances

incore :: (Functor g, Core f) => ((a -> Context a b b) -> s -> Context a b t) -> (f a -> g (f b)) -> f s -> g (f t)Source

This is a generalization of inside to work over any corepresentable Functor.

 incore :: Core f => Lens s t a b -> Lens (f s) (f t) (f a) (f b)