Skip to content

Instantly share code, notes, and snippets.

@danidiaz
Created October 26, 2013 11:00
Show Gist options
  • Select an option

  • Save danidiaz/7168119 to your computer and use it in GitHub Desktop.

Select an option

Save danidiaz/7168119 to your computer and use it in GitHub Desktop.
Isos and au
import Control.Lens
import Data.Foldable
import Data.Monoid
import Data.Complex
import Data.Complex.Lens
r0 = au (from _polar.wrapping Sum) foldMap [(1.0,pi),(1.0,0.0)]
r1 = view _polar $ getSum $ mconcat $ (map $ view $ from _polar.wrapping Sum) [(1.0,pi),(1.0,0.0)]
r2 = view _polar $ getSum $ foldMap (Sum . (view $ from _polar)) [(1.0,pi),(1.0,0.0)]
main = do
putStrLn . show $ r0
putStrLn . show $ r1
putStrLn . show $ r2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment