linear-1.3: Linear Algebra

MaintainerEdward Kmett <>
Safe HaskellSafe-Inferred



Corepresentable functors as vector spaces



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.


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


Core V0 
Core V1 
Core V2 
Core V3 
Core V4 
Core Plucker 
Core Quaternion 
Core f => Core (Point f) 
Dim k n => Core (V k n) 

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)