The purpose of this task is to explore working with   complex numbers.



Task

Given   n,   find the   nth   roots of unity.




import Data.Complex (Complex, cis)
 
rootsOfUnity :: (Enum a, Floating a) => a -> [Complex a]
rootsOfUnity n =
  [ cis (2 * pi * k / n)
  | k <- [0 .. n - 1] ]
 
main :: IO ()
main = mapM_ print $ rootsOfUnity 3