{-# LANGUAGE Safe, QuasiQuotes, TypeOperators #-}
module Data.Invertible.Complex
( complex
, polar
, conjugate
) where
import qualified Data.Complex as C
import Data.Invertible.Bijection
import Data.Invertible.Internal
import Data.Invertible.TH
complex :: (a, a) <-> C.Complex a
complex :: forall a. (a, a) <-> Complex a
complex = [biCase|(r, i) <-> r C.:+ i|]
polar :: RealFloat a => (a, a) <-> C.Complex a
polar :: forall a. RealFloat a => (a, a) <-> Complex a
polar = (a -> a -> Complex a) -> (a, a) -> Complex a
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry a -> a -> Complex a
forall a. Floating a => a -> a -> Complex a
C.mkPolar ((a, a) -> Complex a)
-> (Complex a -> (a, a)) -> Bijection (->) (a, a) (Complex a)
forall (a :: * -> * -> *) b c. a b c -> a c b -> Bijection a b c
:<->: Complex a -> (a, a)
forall a. RealFloat a => Complex a -> (a, a)
C.polar
conjugate :: Num a => C.Complex a <-> C.Complex a
conjugate :: forall a. Num a => Complex a <-> Complex a
conjugate = (Complex a -> Complex a) -> Bijection (->) (Complex a) (Complex a)
forall (a :: * -> * -> *) b. a b b -> Bijection a b b
involution Complex a -> Complex a
forall a. Num a => Complex a -> Complex a
C.conjugate