Portability | Haskell2010 |
---|---|

Stability | provisional |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Safe Haskell | Safe-Infered |

# Documentation

real :: Simple Lens (Complex a) aSource

Access the real part of a complex number

real :: Functor f => (a -> f a) -> Complex a -> f (Complex a)

imaginary :: Simple Lens (Complex a) aSource

Access the imaginary part of a complex number

imaginary :: Functor f => (a -> f a) -> Complex a -> f (Complex a)

polarize :: (RealFloat a, RealFloat b) => Lens (Complex a) (Complex b) (a, a) (b, b)Source

This isn't *quite* a legal lens. Notably the `view l (set l b a) = b`

law
is violated when you set a polar value with 0 magnitude and non-zero phase
as the phase information is lost. So don't do that! Otherwise, this is a
perfectly cromulent lens.

polarize :: (RealFloat a, RealFloat b, Functor f) => ((a,a) -> f (b,b)) -> Complex a -> f (Complex b)

traverseComplex :: Traversal (Complex a) (Complex b) a bSource

Traverse both the real and imaginary parts of a complex number.

traverseComplex :: Applicative f => (a -> f b) -> Complex a -> f (Complex b)