{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}
module Data.Geometry.Ipe.Content(
    Image(Image), imageData, rect
  , TextLabel(..)
  , MiniPage(..), width

  , IpeSymbol(Symbol), symbolPoint, symbolName

  , Path(Path), pathSegments
  , PathSegment(..)

  , Group(Group), groupItems


  , IpeObject(..), _IpeGroup, _IpeImage, _IpeTextLabel, _IpeMiniPage, _IpeUse, _IpePath
  , IpeObject'
  , ipeObject', ToObject(..)

  , IpeAttributes
  , Attributes', AttributesOf, AttrMap, AttrMapSym1
  , attributes, traverseIpeAttrs
  , commonAttributes

  , flattenGroups
  ) where

import           Control.Lens hiding (views)
import           Data.Bitraversable
import           Data.Ext
import           Data.Geometry.Box (Rectangle)
import qualified Data.Geometry.Ipe.Attributes as AT
import           Data.Geometry.Ipe.Attributes hiding (Matrix)
import           Data.Geometry.Ipe.Color
import           Data.Geometry.Ipe.Layer
import           Data.Geometry.Ipe.Path
import           Data.Geometry.Matrix
import           Data.Geometry.Point
import           Data.Geometry.Properties
import           Data.Geometry.Transformation
import           Data.Proxy
import           Data.Singletons.TH (genDefunSymbols)
import           Data.Text (Text)
import           Data.Traversable
import           Data.Vinyl hiding (Label)
import           Data.Vinyl.TypeLevel (AllConstrained)

--------------------------------------------------------------------------------
-- | Image Objects

data Image r = Image { Image r -> ()
_imageData :: ()
                     , Image r -> Rectangle () r
_rect      :: Rectangle () r
                     } deriving (Int -> Image r -> ShowS
[Image r] -> ShowS
Image r -> String
(Int -> Image r -> ShowS)
-> (Image r -> String) -> ([Image r] -> ShowS) -> Show (Image r)
forall r. Show r => Int -> Image r -> ShowS
forall r. Show r => [Image r] -> ShowS
forall r. Show r => Image r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Image r] -> ShowS
$cshowList :: forall r. Show r => [Image r] -> ShowS
show :: Image r -> String
$cshow :: forall r. Show r => Image r -> String
showsPrec :: Int -> Image r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> Image r -> ShowS
Show,Image r -> Image r -> Bool
(Image r -> Image r -> Bool)
-> (Image r -> Image r -> Bool) -> Eq (Image r)
forall r. Eq r => Image r -> Image r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Image r -> Image r -> Bool
$c/= :: forall r. Eq r => Image r -> Image r -> Bool
== :: Image r -> Image r -> Bool
$c== :: forall r. Eq r => Image r -> Image r -> Bool
Eq,Eq (Image r)
Eq (Image r)
-> (Image r -> Image r -> Ordering)
-> (Image r -> Image r -> Bool)
-> (Image r -> Image r -> Bool)
-> (Image r -> Image r -> Bool)
-> (Image r -> Image r -> Bool)
-> (Image r -> Image r -> Image r)
-> (Image r -> Image r -> Image r)
-> Ord (Image r)
Image r -> Image r -> Bool
Image r -> Image r -> Ordering
Image r -> Image r -> Image r
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall r. Ord r => Eq (Image r)
forall r. Ord r => Image r -> Image r -> Bool
forall r. Ord r => Image r -> Image r -> Ordering
forall r. Ord r => Image r -> Image r -> Image r
min :: Image r -> Image r -> Image r
$cmin :: forall r. Ord r => Image r -> Image r -> Image r
max :: Image r -> Image r -> Image r
$cmax :: forall r. Ord r => Image r -> Image r -> Image r
>= :: Image r -> Image r -> Bool
$c>= :: forall r. Ord r => Image r -> Image r -> Bool
> :: Image r -> Image r -> Bool
$c> :: forall r. Ord r => Image r -> Image r -> Bool
<= :: Image r -> Image r -> Bool
$c<= :: forall r. Ord r => Image r -> Image r -> Bool
< :: Image r -> Image r -> Bool
$c< :: forall r. Ord r => Image r -> Image r -> Bool
compare :: Image r -> Image r -> Ordering
$ccompare :: forall r. Ord r => Image r -> Image r -> Ordering
$cp1Ord :: forall r. Ord r => Eq (Image r)
Ord)
makeLenses ''Image

type instance NumType   (Image r) = r
type instance Dimension (Image r) = 2

instance Fractional r => IsTransformable (Image r) where
  transformBy :: Transformation (Dimension (Image r)) (NumType (Image r))
-> Image r -> Image r
transformBy Transformation (Dimension (Image r)) (NumType (Image r))
t = ASetter (Image r) (Image r) (Rectangle () r) (Rectangle () r)
-> (Rectangle () r -> Rectangle () r) -> Image r -> Image r
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over ASetter (Image r) (Image r) (Rectangle () r) (Rectangle () r)
forall r r.
Lens (Image r) (Image r) (Rectangle () r) (Rectangle () r)
rect (Transformation
  (Dimension (Rectangle () r)) (NumType (Rectangle () r))
-> Rectangle () r -> Rectangle () r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation
  (Dimension (Rectangle () r)) (NumType (Rectangle () r))
Transformation (Dimension (Image r)) (NumType (Image r))
t)

instance Functor Image where
  fmap :: (a -> b) -> Image a -> Image b
fmap = (a -> b) -> Image a -> Image b
forall (t :: * -> *) a b. Traversable t => (a -> b) -> t a -> t b
fmapDefault
instance Foldable Image where
  foldMap :: (a -> m) -> Image a -> m
foldMap = (a -> m) -> Image a -> m
forall (t :: * -> *) m a.
(Traversable t, Monoid m) =>
(a -> m) -> t a -> m
foldMapDefault
instance Traversable Image where
  traverse :: (a -> f b) -> Image a -> f (Image b)
traverse a -> f b
f (Image ()
d Rectangle () a
r) = () -> Rectangle () b -> Image b
forall r. () -> Rectangle () r -> Image r
Image ()
d (Rectangle () b -> Image b) -> f (Rectangle () b) -> f (Image b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (() -> f ()) -> (a -> f b) -> Rectangle () a -> f (Rectangle () b)
forall (t :: * -> * -> *) (f :: * -> *) a c b d.
(Bitraversable t, Applicative f) =>
(a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bitraverse () -> f ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure a -> f b
f Rectangle () a
r

--------------------------------------------------------------------------------
-- | Text Objects

data TextLabel r = Label Text (Point 2 r)
                 deriving (Int -> TextLabel r -> ShowS
[TextLabel r] -> ShowS
TextLabel r -> String
(Int -> TextLabel r -> ShowS)
-> (TextLabel r -> String)
-> ([TextLabel r] -> ShowS)
-> Show (TextLabel r)
forall r. Show r => Int -> TextLabel r -> ShowS
forall r. Show r => [TextLabel r] -> ShowS
forall r. Show r => TextLabel r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextLabel r] -> ShowS
$cshowList :: forall r. Show r => [TextLabel r] -> ShowS
show :: TextLabel r -> String
$cshow :: forall r. Show r => TextLabel r -> String
showsPrec :: Int -> TextLabel r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> TextLabel r -> ShowS
Show,TextLabel r -> TextLabel r -> Bool
(TextLabel r -> TextLabel r -> Bool)
-> (TextLabel r -> TextLabel r -> Bool) -> Eq (TextLabel r)
forall r. Eq r => TextLabel r -> TextLabel r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextLabel r -> TextLabel r -> Bool
$c/= :: forall r. Eq r => TextLabel r -> TextLabel r -> Bool
== :: TextLabel r -> TextLabel r -> Bool
$c== :: forall r. Eq r => TextLabel r -> TextLabel r -> Bool
Eq,Eq (TextLabel r)
Eq (TextLabel r)
-> (TextLabel r -> TextLabel r -> Ordering)
-> (TextLabel r -> TextLabel r -> Bool)
-> (TextLabel r -> TextLabel r -> Bool)
-> (TextLabel r -> TextLabel r -> Bool)
-> (TextLabel r -> TextLabel r -> Bool)
-> (TextLabel r -> TextLabel r -> TextLabel r)
-> (TextLabel r -> TextLabel r -> TextLabel r)
-> Ord (TextLabel r)
TextLabel r -> TextLabel r -> Bool
TextLabel r -> TextLabel r -> Ordering
TextLabel r -> TextLabel r -> TextLabel r
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall r. Ord r => Eq (TextLabel r)
forall r. Ord r => TextLabel r -> TextLabel r -> Bool
forall r. Ord r => TextLabel r -> TextLabel r -> Ordering
forall r. Ord r => TextLabel r -> TextLabel r -> TextLabel r
min :: TextLabel r -> TextLabel r -> TextLabel r
$cmin :: forall r. Ord r => TextLabel r -> TextLabel r -> TextLabel r
max :: TextLabel r -> TextLabel r -> TextLabel r
$cmax :: forall r. Ord r => TextLabel r -> TextLabel r -> TextLabel r
>= :: TextLabel r -> TextLabel r -> Bool
$c>= :: forall r. Ord r => TextLabel r -> TextLabel r -> Bool
> :: TextLabel r -> TextLabel r -> Bool
$c> :: forall r. Ord r => TextLabel r -> TextLabel r -> Bool
<= :: TextLabel r -> TextLabel r -> Bool
$c<= :: forall r. Ord r => TextLabel r -> TextLabel r -> Bool
< :: TextLabel r -> TextLabel r -> Bool
$c< :: forall r. Ord r => TextLabel r -> TextLabel r -> Bool
compare :: TextLabel r -> TextLabel r -> Ordering
$ccompare :: forall r. Ord r => TextLabel r -> TextLabel r -> Ordering
$cp1Ord :: forall r. Ord r => Eq (TextLabel r)
Ord,a -> TextLabel b -> TextLabel a
(a -> b) -> TextLabel a -> TextLabel b
(forall a b. (a -> b) -> TextLabel a -> TextLabel b)
-> (forall a b. a -> TextLabel b -> TextLabel a)
-> Functor TextLabel
forall a b. a -> TextLabel b -> TextLabel a
forall a b. (a -> b) -> TextLabel a -> TextLabel b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> TextLabel b -> TextLabel a
$c<$ :: forall a b. a -> TextLabel b -> TextLabel a
fmap :: (a -> b) -> TextLabel a -> TextLabel b
$cfmap :: forall a b. (a -> b) -> TextLabel a -> TextLabel b
Functor,TextLabel a -> Bool
(a -> m) -> TextLabel a -> m
(a -> b -> b) -> b -> TextLabel a -> b
(forall m. Monoid m => TextLabel m -> m)
-> (forall m a. Monoid m => (a -> m) -> TextLabel a -> m)
-> (forall m a. Monoid m => (a -> m) -> TextLabel a -> m)
-> (forall a b. (a -> b -> b) -> b -> TextLabel a -> b)
-> (forall a b. (a -> b -> b) -> b -> TextLabel a -> b)
-> (forall b a. (b -> a -> b) -> b -> TextLabel a -> b)
-> (forall b a. (b -> a -> b) -> b -> TextLabel a -> b)
-> (forall a. (a -> a -> a) -> TextLabel a -> a)
-> (forall a. (a -> a -> a) -> TextLabel a -> a)
-> (forall a. TextLabel a -> [a])
-> (forall a. TextLabel a -> Bool)
-> (forall a. TextLabel a -> Int)
-> (forall a. Eq a => a -> TextLabel a -> Bool)
-> (forall a. Ord a => TextLabel a -> a)
-> (forall a. Ord a => TextLabel a -> a)
-> (forall a. Num a => TextLabel a -> a)
-> (forall a. Num a => TextLabel a -> a)
-> Foldable TextLabel
forall a. Eq a => a -> TextLabel a -> Bool
forall a. Num a => TextLabel a -> a
forall a. Ord a => TextLabel a -> a
forall m. Monoid m => TextLabel m -> m
forall a. TextLabel a -> Bool
forall a. TextLabel a -> Int
forall a. TextLabel a -> [a]
forall a. (a -> a -> a) -> TextLabel a -> a
forall m a. Monoid m => (a -> m) -> TextLabel a -> m
forall b a. (b -> a -> b) -> b -> TextLabel a -> b
forall a b. (a -> b -> b) -> b -> TextLabel a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: TextLabel a -> a
$cproduct :: forall a. Num a => TextLabel a -> a
sum :: TextLabel a -> a
$csum :: forall a. Num a => TextLabel a -> a
minimum :: TextLabel a -> a
$cminimum :: forall a. Ord a => TextLabel a -> a
maximum :: TextLabel a -> a
$cmaximum :: forall a. Ord a => TextLabel a -> a
elem :: a -> TextLabel a -> Bool
$celem :: forall a. Eq a => a -> TextLabel a -> Bool
length :: TextLabel a -> Int
$clength :: forall a. TextLabel a -> Int
null :: TextLabel a -> Bool
$cnull :: forall a. TextLabel a -> Bool
toList :: TextLabel a -> [a]
$ctoList :: forall a. TextLabel a -> [a]
foldl1 :: (a -> a -> a) -> TextLabel a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> TextLabel a -> a
foldr1 :: (a -> a -> a) -> TextLabel a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> TextLabel a -> a
foldl' :: (b -> a -> b) -> b -> TextLabel a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> TextLabel a -> b
foldl :: (b -> a -> b) -> b -> TextLabel a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> TextLabel a -> b
foldr' :: (a -> b -> b) -> b -> TextLabel a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> TextLabel a -> b
foldr :: (a -> b -> b) -> b -> TextLabel a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> TextLabel a -> b
foldMap' :: (a -> m) -> TextLabel a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> TextLabel a -> m
foldMap :: (a -> m) -> TextLabel a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> TextLabel a -> m
fold :: TextLabel m -> m
$cfold :: forall m. Monoid m => TextLabel m -> m
Foldable,Functor TextLabel
Foldable TextLabel
Functor TextLabel
-> Foldable TextLabel
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> TextLabel a -> f (TextLabel b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    TextLabel (f a) -> f (TextLabel a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> TextLabel a -> m (TextLabel b))
-> (forall (m :: * -> *) a.
    Monad m =>
    TextLabel (m a) -> m (TextLabel a))
-> Traversable TextLabel
(a -> f b) -> TextLabel a -> f (TextLabel b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
TextLabel (m a) -> m (TextLabel a)
forall (f :: * -> *) a.
Applicative f =>
TextLabel (f a) -> f (TextLabel a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> TextLabel a -> m (TextLabel b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TextLabel a -> f (TextLabel b)
sequence :: TextLabel (m a) -> m (TextLabel a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
TextLabel (m a) -> m (TextLabel a)
mapM :: (a -> m b) -> TextLabel a -> m (TextLabel b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> TextLabel a -> m (TextLabel b)
sequenceA :: TextLabel (f a) -> f (TextLabel a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
TextLabel (f a) -> f (TextLabel a)
traverse :: (a -> f b) -> TextLabel a -> f (TextLabel b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TextLabel a -> f (TextLabel b)
$cp2Traversable :: Foldable TextLabel
$cp1Traversable :: Functor TextLabel
Traversable)

data MiniPage r = MiniPage Text (Point 2 r) r
                 deriving (Int -> MiniPage r -> ShowS
[MiniPage r] -> ShowS
MiniPage r -> String
(Int -> MiniPage r -> ShowS)
-> (MiniPage r -> String)
-> ([MiniPage r] -> ShowS)
-> Show (MiniPage r)
forall r. Show r => Int -> MiniPage r -> ShowS
forall r. Show r => [MiniPage r] -> ShowS
forall r. Show r => MiniPage r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MiniPage r] -> ShowS
$cshowList :: forall r. Show r => [MiniPage r] -> ShowS
show :: MiniPage r -> String
$cshow :: forall r. Show r => MiniPage r -> String
showsPrec :: Int -> MiniPage r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> MiniPage r -> ShowS
Show,MiniPage r -> MiniPage r -> Bool
(MiniPage r -> MiniPage r -> Bool)
-> (MiniPage r -> MiniPage r -> Bool) -> Eq (MiniPage r)
forall r. Eq r => MiniPage r -> MiniPage r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MiniPage r -> MiniPage r -> Bool
$c/= :: forall r. Eq r => MiniPage r -> MiniPage r -> Bool
== :: MiniPage r -> MiniPage r -> Bool
$c== :: forall r. Eq r => MiniPage r -> MiniPage r -> Bool
Eq,Eq (MiniPage r)
Eq (MiniPage r)
-> (MiniPage r -> MiniPage r -> Ordering)
-> (MiniPage r -> MiniPage r -> Bool)
-> (MiniPage r -> MiniPage r -> Bool)
-> (MiniPage r -> MiniPage r -> Bool)
-> (MiniPage r -> MiniPage r -> Bool)
-> (MiniPage r -> MiniPage r -> MiniPage r)
-> (MiniPage r -> MiniPage r -> MiniPage r)
-> Ord (MiniPage r)
MiniPage r -> MiniPage r -> Bool
MiniPage r -> MiniPage r -> Ordering
MiniPage r -> MiniPage r -> MiniPage r
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall r. Ord r => Eq (MiniPage r)
forall r. Ord r => MiniPage r -> MiniPage r -> Bool
forall r. Ord r => MiniPage r -> MiniPage r -> Ordering
forall r. Ord r => MiniPage r -> MiniPage r -> MiniPage r
min :: MiniPage r -> MiniPage r -> MiniPage r
$cmin :: forall r. Ord r => MiniPage r -> MiniPage r -> MiniPage r
max :: MiniPage r -> MiniPage r -> MiniPage r
$cmax :: forall r. Ord r => MiniPage r -> MiniPage r -> MiniPage r
>= :: MiniPage r -> MiniPage r -> Bool
$c>= :: forall r. Ord r => MiniPage r -> MiniPage r -> Bool
> :: MiniPage r -> MiniPage r -> Bool
$c> :: forall r. Ord r => MiniPage r -> MiniPage r -> Bool
<= :: MiniPage r -> MiniPage r -> Bool
$c<= :: forall r. Ord r => MiniPage r -> MiniPage r -> Bool
< :: MiniPage r -> MiniPage r -> Bool
$c< :: forall r. Ord r => MiniPage r -> MiniPage r -> Bool
compare :: MiniPage r -> MiniPage r -> Ordering
$ccompare :: forall r. Ord r => MiniPage r -> MiniPage r -> Ordering
$cp1Ord :: forall r. Ord r => Eq (MiniPage r)
Ord,a -> MiniPage b -> MiniPage a
(a -> b) -> MiniPage a -> MiniPage b
(forall a b. (a -> b) -> MiniPage a -> MiniPage b)
-> (forall a b. a -> MiniPage b -> MiniPage a) -> Functor MiniPage
forall a b. a -> MiniPage b -> MiniPage a
forall a b. (a -> b) -> MiniPage a -> MiniPage b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> MiniPage b -> MiniPage a
$c<$ :: forall a b. a -> MiniPage b -> MiniPage a
fmap :: (a -> b) -> MiniPage a -> MiniPage b
$cfmap :: forall a b. (a -> b) -> MiniPage a -> MiniPage b
Functor,MiniPage a -> Bool
(a -> m) -> MiniPage a -> m
(a -> b -> b) -> b -> MiniPage a -> b
(forall m. Monoid m => MiniPage m -> m)
-> (forall m a. Monoid m => (a -> m) -> MiniPage a -> m)
-> (forall m a. Monoid m => (a -> m) -> MiniPage a -> m)
-> (forall a b. (a -> b -> b) -> b -> MiniPage a -> b)
-> (forall a b. (a -> b -> b) -> b -> MiniPage a -> b)
-> (forall b a. (b -> a -> b) -> b -> MiniPage a -> b)
-> (forall b a. (b -> a -> b) -> b -> MiniPage a -> b)
-> (forall a. (a -> a -> a) -> MiniPage a -> a)
-> (forall a. (a -> a -> a) -> MiniPage a -> a)
-> (forall a. MiniPage a -> [a])
-> (forall a. MiniPage a -> Bool)
-> (forall a. MiniPage a -> Int)
-> (forall a. Eq a => a -> MiniPage a -> Bool)
-> (forall a. Ord a => MiniPage a -> a)
-> (forall a. Ord a => MiniPage a -> a)
-> (forall a. Num a => MiniPage a -> a)
-> (forall a. Num a => MiniPage a -> a)
-> Foldable MiniPage
forall a. Eq a => a -> MiniPage a -> Bool
forall a. Num a => MiniPage a -> a
forall a. Ord a => MiniPage a -> a
forall m. Monoid m => MiniPage m -> m
forall a. MiniPage a -> Bool
forall a. MiniPage a -> Int
forall a. MiniPage a -> [a]
forall a. (a -> a -> a) -> MiniPage a -> a
forall m a. Monoid m => (a -> m) -> MiniPage a -> m
forall b a. (b -> a -> b) -> b -> MiniPage a -> b
forall a b. (a -> b -> b) -> b -> MiniPage a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: MiniPage a -> a
$cproduct :: forall a. Num a => MiniPage a -> a
sum :: MiniPage a -> a
$csum :: forall a. Num a => MiniPage a -> a
minimum :: MiniPage a -> a
$cminimum :: forall a. Ord a => MiniPage a -> a
maximum :: MiniPage a -> a
$cmaximum :: forall a. Ord a => MiniPage a -> a
elem :: a -> MiniPage a -> Bool
$celem :: forall a. Eq a => a -> MiniPage a -> Bool
length :: MiniPage a -> Int
$clength :: forall a. MiniPage a -> Int
null :: MiniPage a -> Bool
$cnull :: forall a. MiniPage a -> Bool
toList :: MiniPage a -> [a]
$ctoList :: forall a. MiniPage a -> [a]
foldl1 :: (a -> a -> a) -> MiniPage a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> MiniPage a -> a
foldr1 :: (a -> a -> a) -> MiniPage a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> MiniPage a -> a
foldl' :: (b -> a -> b) -> b -> MiniPage a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> MiniPage a -> b
foldl :: (b -> a -> b) -> b -> MiniPage a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> MiniPage a -> b
foldr' :: (a -> b -> b) -> b -> MiniPage a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> MiniPage a -> b
foldr :: (a -> b -> b) -> b -> MiniPage a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> MiniPage a -> b
foldMap' :: (a -> m) -> MiniPage a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> MiniPage a -> m
foldMap :: (a -> m) -> MiniPage a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> MiniPage a -> m
fold :: MiniPage m -> m
$cfold :: forall m. Monoid m => MiniPage m -> m
Foldable,Functor MiniPage
Foldable MiniPage
Functor MiniPage
-> Foldable MiniPage
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> MiniPage a -> f (MiniPage b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    MiniPage (f a) -> f (MiniPage a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> MiniPage a -> m (MiniPage b))
-> (forall (m :: * -> *) a.
    Monad m =>
    MiniPage (m a) -> m (MiniPage a))
-> Traversable MiniPage
(a -> f b) -> MiniPage a -> f (MiniPage b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => MiniPage (m a) -> m (MiniPage a)
forall (f :: * -> *) a.
Applicative f =>
MiniPage (f a) -> f (MiniPage a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> MiniPage a -> m (MiniPage b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> MiniPage a -> f (MiniPage b)
sequence :: MiniPage (m a) -> m (MiniPage a)
$csequence :: forall (m :: * -> *) a. Monad m => MiniPage (m a) -> m (MiniPage a)
mapM :: (a -> m b) -> MiniPage a -> m (MiniPage b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> MiniPage a -> m (MiniPage b)
sequenceA :: MiniPage (f a) -> f (MiniPage a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
MiniPage (f a) -> f (MiniPage a)
traverse :: (a -> f b) -> MiniPage a -> f (MiniPage b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> MiniPage a -> f (MiniPage b)
$cp2Traversable :: Foldable MiniPage
$cp1Traversable :: Functor MiniPage
Traversable)

type instance NumType   (TextLabel r) = r
type instance Dimension (TextLabel r) = 2

type instance NumType   (MiniPage r) = r
type instance Dimension (MiniPage r) = 2

instance Fractional r => IsTransformable (TextLabel r) where
  transformBy :: Transformation (Dimension (TextLabel r)) (NumType (TextLabel r))
-> TextLabel r -> TextLabel r
transformBy Transformation (Dimension (TextLabel r)) (NumType (TextLabel r))
t (Label Text
txt Point 2 r
p) = Text -> Point 2 r -> TextLabel r
forall r. Text -> Point 2 r -> TextLabel r
Label Text
txt (Transformation (Dimension (Point 2 r)) (NumType (Point 2 r))
-> Point 2 r -> Point 2 r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (Point 2 r)) (NumType (Point 2 r))
Transformation (Dimension (TextLabel r)) (NumType (TextLabel r))
t Point 2 r
p)

instance Fractional r => IsTransformable (MiniPage r) where
  transformBy :: Transformation (Dimension (MiniPage r)) (NumType (MiniPage r))
-> MiniPage r -> MiniPage r
transformBy Transformation (Dimension (MiniPage r)) (NumType (MiniPage r))
t (MiniPage Text
txt Point 2 r
p r
w) = Text -> Point 2 r -> r -> MiniPage r
forall r. Text -> Point 2 r -> r -> MiniPage r
MiniPage Text
txt (Transformation (Dimension (Point 2 r)) (NumType (Point 2 r))
-> Point 2 r -> Point 2 r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (Point 2 r)) (NumType (Point 2 r))
Transformation (Dimension (MiniPage r)) (NumType (MiniPage r))
t Point 2 r
p) r
w

width                  :: MiniPage t -> t
width :: MiniPage t -> t
width (MiniPage Text
_ Point 2 t
_ t
w) = t
w

--------------------------------------------------------------------------------
-- | Ipe Symbols, i.e. Points

-- | A symbol (point) in ipe
data IpeSymbol r = Symbol { IpeSymbol r -> Point 2 r
_symbolPoint :: Point 2 r
                          , IpeSymbol r -> Text
_symbolName  :: Text
                          }
                 deriving (Int -> IpeSymbol r -> ShowS
[IpeSymbol r] -> ShowS
IpeSymbol r -> String
(Int -> IpeSymbol r -> ShowS)
-> (IpeSymbol r -> String)
-> ([IpeSymbol r] -> ShowS)
-> Show (IpeSymbol r)
forall r. Show r => Int -> IpeSymbol r -> ShowS
forall r. Show r => [IpeSymbol r] -> ShowS
forall r. Show r => IpeSymbol r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IpeSymbol r] -> ShowS
$cshowList :: forall r. Show r => [IpeSymbol r] -> ShowS
show :: IpeSymbol r -> String
$cshow :: forall r. Show r => IpeSymbol r -> String
showsPrec :: Int -> IpeSymbol r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> IpeSymbol r -> ShowS
Show,IpeSymbol r -> IpeSymbol r -> Bool
(IpeSymbol r -> IpeSymbol r -> Bool)
-> (IpeSymbol r -> IpeSymbol r -> Bool) -> Eq (IpeSymbol r)
forall r. Eq r => IpeSymbol r -> IpeSymbol r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IpeSymbol r -> IpeSymbol r -> Bool
$c/= :: forall r. Eq r => IpeSymbol r -> IpeSymbol r -> Bool
== :: IpeSymbol r -> IpeSymbol r -> Bool
$c== :: forall r. Eq r => IpeSymbol r -> IpeSymbol r -> Bool
Eq,Eq (IpeSymbol r)
Eq (IpeSymbol r)
-> (IpeSymbol r -> IpeSymbol r -> Ordering)
-> (IpeSymbol r -> IpeSymbol r -> Bool)
-> (IpeSymbol r -> IpeSymbol r -> Bool)
-> (IpeSymbol r -> IpeSymbol r -> Bool)
-> (IpeSymbol r -> IpeSymbol r -> Bool)
-> (IpeSymbol r -> IpeSymbol r -> IpeSymbol r)
-> (IpeSymbol r -> IpeSymbol r -> IpeSymbol r)
-> Ord (IpeSymbol r)
IpeSymbol r -> IpeSymbol r -> Bool
IpeSymbol r -> IpeSymbol r -> Ordering
IpeSymbol r -> IpeSymbol r -> IpeSymbol r
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall r. Ord r => Eq (IpeSymbol r)
forall r. Ord r => IpeSymbol r -> IpeSymbol r -> Bool
forall r. Ord r => IpeSymbol r -> IpeSymbol r -> Ordering
forall r. Ord r => IpeSymbol r -> IpeSymbol r -> IpeSymbol r
min :: IpeSymbol r -> IpeSymbol r -> IpeSymbol r
$cmin :: forall r. Ord r => IpeSymbol r -> IpeSymbol r -> IpeSymbol r
max :: IpeSymbol r -> IpeSymbol r -> IpeSymbol r
$cmax :: forall r. Ord r => IpeSymbol r -> IpeSymbol r -> IpeSymbol r
>= :: IpeSymbol r -> IpeSymbol r -> Bool
$c>= :: forall r. Ord r => IpeSymbol r -> IpeSymbol r -> Bool
> :: IpeSymbol r -> IpeSymbol r -> Bool
$c> :: forall r. Ord r => IpeSymbol r -> IpeSymbol r -> Bool
<= :: IpeSymbol r -> IpeSymbol r -> Bool
$c<= :: forall r. Ord r => IpeSymbol r -> IpeSymbol r -> Bool
< :: IpeSymbol r -> IpeSymbol r -> Bool
$c< :: forall r. Ord r => IpeSymbol r -> IpeSymbol r -> Bool
compare :: IpeSymbol r -> IpeSymbol r -> Ordering
$ccompare :: forall r. Ord r => IpeSymbol r -> IpeSymbol r -> Ordering
$cp1Ord :: forall r. Ord r => Eq (IpeSymbol r)
Ord,a -> IpeSymbol b -> IpeSymbol a
(a -> b) -> IpeSymbol a -> IpeSymbol b
(forall a b. (a -> b) -> IpeSymbol a -> IpeSymbol b)
-> (forall a b. a -> IpeSymbol b -> IpeSymbol a)
-> Functor IpeSymbol
forall a b. a -> IpeSymbol b -> IpeSymbol a
forall a b. (a -> b) -> IpeSymbol a -> IpeSymbol b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> IpeSymbol b -> IpeSymbol a
$c<$ :: forall a b. a -> IpeSymbol b -> IpeSymbol a
fmap :: (a -> b) -> IpeSymbol a -> IpeSymbol b
$cfmap :: forall a b. (a -> b) -> IpeSymbol a -> IpeSymbol b
Functor,IpeSymbol a -> Bool
(a -> m) -> IpeSymbol a -> m
(a -> b -> b) -> b -> IpeSymbol a -> b
(forall m. Monoid m => IpeSymbol m -> m)
-> (forall m a. Monoid m => (a -> m) -> IpeSymbol a -> m)
-> (forall m a. Monoid m => (a -> m) -> IpeSymbol a -> m)
-> (forall a b. (a -> b -> b) -> b -> IpeSymbol a -> b)
-> (forall a b. (a -> b -> b) -> b -> IpeSymbol a -> b)
-> (forall b a. (b -> a -> b) -> b -> IpeSymbol a -> b)
-> (forall b a. (b -> a -> b) -> b -> IpeSymbol a -> b)
-> (forall a. (a -> a -> a) -> IpeSymbol a -> a)
-> (forall a. (a -> a -> a) -> IpeSymbol a -> a)
-> (forall a. IpeSymbol a -> [a])
-> (forall a. IpeSymbol a -> Bool)
-> (forall a. IpeSymbol a -> Int)
-> (forall a. Eq a => a -> IpeSymbol a -> Bool)
-> (forall a. Ord a => IpeSymbol a -> a)
-> (forall a. Ord a => IpeSymbol a -> a)
-> (forall a. Num a => IpeSymbol a -> a)
-> (forall a. Num a => IpeSymbol a -> a)
-> Foldable IpeSymbol
forall a. Eq a => a -> IpeSymbol a -> Bool
forall a. Num a => IpeSymbol a -> a
forall a. Ord a => IpeSymbol a -> a
forall m. Monoid m => IpeSymbol m -> m
forall a. IpeSymbol a -> Bool
forall a. IpeSymbol a -> Int
forall a. IpeSymbol a -> [a]
forall a. (a -> a -> a) -> IpeSymbol a -> a
forall m a. Monoid m => (a -> m) -> IpeSymbol a -> m
forall b a. (b -> a -> b) -> b -> IpeSymbol a -> b
forall a b. (a -> b -> b) -> b -> IpeSymbol a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: IpeSymbol a -> a
$cproduct :: forall a. Num a => IpeSymbol a -> a
sum :: IpeSymbol a -> a
$csum :: forall a. Num a => IpeSymbol a -> a
minimum :: IpeSymbol a -> a
$cminimum :: forall a. Ord a => IpeSymbol a -> a
maximum :: IpeSymbol a -> a
$cmaximum :: forall a. Ord a => IpeSymbol a -> a
elem :: a -> IpeSymbol a -> Bool
$celem :: forall a. Eq a => a -> IpeSymbol a -> Bool
length :: IpeSymbol a -> Int
$clength :: forall a. IpeSymbol a -> Int
null :: IpeSymbol a -> Bool
$cnull :: forall a. IpeSymbol a -> Bool
toList :: IpeSymbol a -> [a]
$ctoList :: forall a. IpeSymbol a -> [a]
foldl1 :: (a -> a -> a) -> IpeSymbol a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> IpeSymbol a -> a
foldr1 :: (a -> a -> a) -> IpeSymbol a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> IpeSymbol a -> a
foldl' :: (b -> a -> b) -> b -> IpeSymbol a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> IpeSymbol a -> b
foldl :: (b -> a -> b) -> b -> IpeSymbol a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> IpeSymbol a -> b
foldr' :: (a -> b -> b) -> b -> IpeSymbol a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> IpeSymbol a -> b
foldr :: (a -> b -> b) -> b -> IpeSymbol a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> IpeSymbol a -> b
foldMap' :: (a -> m) -> IpeSymbol a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> IpeSymbol a -> m
foldMap :: (a -> m) -> IpeSymbol a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> IpeSymbol a -> m
fold :: IpeSymbol m -> m
$cfold :: forall m. Monoid m => IpeSymbol m -> m
Foldable,Functor IpeSymbol
Foldable IpeSymbol
Functor IpeSymbol
-> Foldable IpeSymbol
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> IpeSymbol a -> f (IpeSymbol b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    IpeSymbol (f a) -> f (IpeSymbol a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> IpeSymbol a -> m (IpeSymbol b))
-> (forall (m :: * -> *) a.
    Monad m =>
    IpeSymbol (m a) -> m (IpeSymbol a))
-> Traversable IpeSymbol
(a -> f b) -> IpeSymbol a -> f (IpeSymbol b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
IpeSymbol (m a) -> m (IpeSymbol a)
forall (f :: * -> *) a.
Applicative f =>
IpeSymbol (f a) -> f (IpeSymbol a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> IpeSymbol a -> m (IpeSymbol b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> IpeSymbol a -> f (IpeSymbol b)
sequence :: IpeSymbol (m a) -> m (IpeSymbol a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
IpeSymbol (m a) -> m (IpeSymbol a)
mapM :: (a -> m b) -> IpeSymbol a -> m (IpeSymbol b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> IpeSymbol a -> m (IpeSymbol b)
sequenceA :: IpeSymbol (f a) -> f (IpeSymbol a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
IpeSymbol (f a) -> f (IpeSymbol a)
traverse :: (a -> f b) -> IpeSymbol a -> f (IpeSymbol b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> IpeSymbol a -> f (IpeSymbol b)
$cp2Traversable :: Foldable IpeSymbol
$cp1Traversable :: Functor IpeSymbol
Traversable)
makeLenses ''IpeSymbol

type instance NumType   (IpeSymbol r) = r
type instance Dimension (IpeSymbol r) = 2

instance Fractional r => IsTransformable (IpeSymbol r) where
  transformBy :: Transformation (Dimension (IpeSymbol r)) (NumType (IpeSymbol r))
-> IpeSymbol r -> IpeSymbol r
transformBy Transformation (Dimension (IpeSymbol r)) (NumType (IpeSymbol r))
t = ASetter (IpeSymbol r) (IpeSymbol r) (Point 2 r) (Point 2 r)
-> (Point 2 r -> Point 2 r) -> IpeSymbol r -> IpeSymbol r
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
over ASetter (IpeSymbol r) (IpeSymbol r) (Point 2 r) (Point 2 r)
forall r r.
Lens (IpeSymbol r) (IpeSymbol r) (Point 2 r) (Point 2 r)
symbolPoint (Transformation (Dimension (Point 2 r)) (NumType (Point 2 r))
-> Point 2 r -> Point 2 r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (Point 2 r)) (NumType (Point 2 r))
Transformation (Dimension (IpeSymbol r)) (NumType (IpeSymbol r))
t)



-- | Example of an IpeSymbol. I.e. A symbol that expresses that the size is 'large'
-- sizeSymbol :: Attributes (AttrMapSym1 r) (SymbolAttributes r)
-- sizeSymbol = attr SSize (IpeSize $ Named "large")


--------------------------------------------------------------------------------
-- * Paths are in a separate module

--------------------------------------------------------------------------------
-- * Attribute Mapping


-- | The mapping between the labels of the the attributes and the types of the
-- attributes with these labels. For example, the 'Matrix' label/attribute should
-- have a value of type 'Matrix 3 3 r'.
type family AttrMap (r :: *) (l :: AttributeUniverse) :: * where
  AttrMap r 'Layer          = LayerName
  AttrMap r AT.Matrix       = Matrix 3 3 r
  AttrMap r Pin             = PinType
  AttrMap r Transformations = TransformationTypes

  AttrMap r Stroke = IpeColor r
  AttrMap r Pen    = IpePen r
  AttrMap r Fill   = IpeColor r
  AttrMap r Size   = IpeSize r

  AttrMap r Dash     = IpeDash r
  AttrMap r LineCap  = Int
  AttrMap r LineJoin = Int
  AttrMap r FillRule = FillType
  AttrMap r Arrow    = IpeArrow r
  AttrMap r RArrow   = IpeArrow r
  AttrMap r Opacity  = IpeOpacity
  AttrMap r Tiling   = IpeTiling
  AttrMap r Gradient = IpeGradient

  AttrMap r Clip = Path r -- strictly we event want this to be a closed path I guess

genDefunSymbols [''AttrMap]

--------------------------------------------------------------------------------


-- | For the types representing attribute values we can get the name/key to use
-- when serializing to ipe.
class TraverseIpeAttr (a :: AttributeUniverse) where
  traverseIpeAttr :: Applicative h
                  => (r -> h s) -> Attr (AttrMapSym1 r) a -> h (Attr (AttrMapSym1 s) a)

  -- attrName :: proxy a -> Text

-- CommonAttributeUnivers
instance TraverseIpeAttr Layer           where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Layer -> h (Attr (AttrMapSym1 s) 'Layer)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'Layer -> h (Attr (AttrMapSym1 s) 'Layer)
forall u (h :: * -> *) (f :: u ~> *) (a :: u) (g :: u ~> *).
(Applicative h, Apply f a ~ Apply g a) =>
Attr f a -> h (Attr g a)
pureAttr
instance TraverseIpeAttr AT.Matrix       where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Matrix -> h (Attr (AttrMapSym1 s) 'Matrix)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Matrix
 -> h (Apply (AttrMapSym1 s) 'Matrix))
-> Attr (AttrMapSym1 r) 'Matrix -> h (Attr (AttrMapSym1 s) 'Matrix)
forall u (h :: * -> *) (f :: u ~> *) (label :: u) (g :: u ~> *).
Applicative h =>
(Apply f label -> h (Apply g label))
-> Attr f label -> h (Attr g label)
traverseAttr ((r -> h s) -> Matrix 3 3 r -> h (Matrix 3 3 s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse r -> h s
f)
instance TraverseIpeAttr Pin             where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Pin -> h (Attr (AttrMapSym1 s) 'Pin)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'Pin -> h (Attr (AttrMapSym1 s) 'Pin)
forall u (h :: * -> *) (f :: u ~> *) (a :: u) (g :: u ~> *).
(Applicative h, Apply f a ~ Apply g a) =>
Attr f a -> h (Attr g a)
pureAttr
instance TraverseIpeAttr Transformations where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Transformations
-> h (Attr (AttrMapSym1 s) 'Transformations)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'Transformations
-> h (Attr (AttrMapSym1 s) 'Transformations)
forall u (h :: * -> *) (f :: u ~> *) (a :: u) (g :: u ~> *).
(Applicative h, Apply f a ~ Apply g a) =>
Attr f a -> h (Attr g a)
pureAttr

-- -- IpeSymbolAttributeUniversre
instance TraverseIpeAttr Stroke       where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Stroke -> h (Attr (AttrMapSym1 s) 'Stroke)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Stroke
 -> h (Apply (AttrMapSym1 s) 'Stroke))
-> Attr (AttrMapSym1 r) 'Stroke -> h (Attr (AttrMapSym1 s) 'Stroke)
forall u (h :: * -> *) (f :: u ~> *) (label :: u) (g :: u ~> *).
Applicative h =>
(Apply f label -> h (Apply g label))
-> Attr f label -> h (Attr g label)
traverseAttr ((r -> h s) -> IpeColor r -> h (IpeColor s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse r -> h s
f)
instance TraverseIpeAttr Fill         where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Fill -> h (Attr (AttrMapSym1 s) 'Fill)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Fill -> h (Apply (AttrMapSym1 s) 'Fill))
-> Attr (AttrMapSym1 r) 'Fill -> h (Attr (AttrMapSym1 s) 'Fill)
forall u (h :: * -> *) (f :: u ~> *) (label :: u) (g :: u ~> *).
Applicative h =>
(Apply f label -> h (Apply g label))
-> Attr f label -> h (Attr g label)
traverseAttr ((r -> h s) -> IpeColor r -> h (IpeColor s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse r -> h s
f)
instance TraverseIpeAttr Pen          where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Pen -> h (Attr (AttrMapSym1 s) 'Pen)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Pen -> h (Apply (AttrMapSym1 s) 'Pen))
-> Attr (AttrMapSym1 r) 'Pen -> h (Attr (AttrMapSym1 s) 'Pen)
forall u (h :: * -> *) (f :: u ~> *) (label :: u) (g :: u ~> *).
Applicative h =>
(Apply f label -> h (Apply g label))
-> Attr f label -> h (Attr g label)
traverseAttr ((r -> h s) -> IpePen r -> h (IpePen s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse r -> h s
f)
instance TraverseIpeAttr Size         where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Size -> h (Attr (AttrMapSym1 s) 'Size)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Size -> h (Apply (AttrMapSym1 s) 'Size))
-> Attr (AttrMapSym1 r) 'Size -> h (Attr (AttrMapSym1 s) 'Size)
forall u (h :: * -> *) (f :: u ~> *) (label :: u) (g :: u ~> *).
Applicative h =>
(Apply f label -> h (Apply g label))
-> Attr f label -> h (Attr g label)
traverseAttr ((r -> h s) -> IpeSize r -> h (IpeSize s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse r -> h s
f)

-- -- PathAttributeUniverse
instance TraverseIpeAttr Dash       where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Dash -> h (Attr (AttrMapSym1 s) 'Dash)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Dash -> h (Apply (AttrMapSym1 s) 'Dash))
-> Attr (AttrMapSym1 r) 'Dash -> h (Attr (AttrMapSym1 s) 'Dash)
forall u (h :: * -> *) (f :: u ~> *) (label :: u) (g :: u ~> *).
Applicative h =>
(Apply f label -> h (Apply g label))
-> Attr f label -> h (Attr g label)
traverseAttr ((r -> h s) -> IpeDash r -> h (IpeDash s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse r -> h s
f)
instance TraverseIpeAttr LineCap    where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'LineCap
-> h (Attr (AttrMapSym1 s) 'LineCap)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'LineCap -> h (Attr (AttrMapSym1 s) 'LineCap)
forall u (h :: * -> *) (f :: u ~> *) (a :: u) (g :: u ~> *).
(Applicative h, Apply f a ~ Apply g a) =>
Attr f a -> h (Attr g a)
pureAttr
instance TraverseIpeAttr LineJoin   where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'LineJoin
-> h (Attr (AttrMapSym1 s) 'LineJoin)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'LineJoin
-> h (Attr (AttrMapSym1 s) 'LineJoin)
forall u (h :: * -> *) (f :: u ~> *) (a :: u) (g :: u ~> *).
(Applicative h, Apply f a ~ Apply g a) =>
Attr f a -> h (Attr g a)
pureAttr
instance TraverseIpeAttr FillRule   where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'FillRule
-> h (Attr (AttrMapSym1 s) 'FillRule)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'FillRule
-> h (Attr (AttrMapSym1 s) 'FillRule)
forall u (h :: * -> *) (f :: u ~> *) (a :: u) (g :: u ~> *).
(Applicative h, Apply f a ~ Apply g a) =>
Attr f a -> h (Attr g a)
pureAttr
instance TraverseIpeAttr Arrow      where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Arrow -> h (Attr (AttrMapSym1 s) 'Arrow)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Arrow -> h (Apply (AttrMapSym1 s) 'Arrow))
-> Attr (AttrMapSym1 r) 'Arrow -> h (Attr (AttrMapSym1 s) 'Arrow)
forall u (h :: * -> *) (f :: u ~> *) (label :: u) (g :: u ~> *).
Applicative h =>
(Apply f label -> h (Apply g label))
-> Attr f label -> h (Attr g label)
traverseAttr ((r -> h s) -> IpeArrow r -> h (IpeArrow s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse r -> h s
f)
instance TraverseIpeAttr RArrow     where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'RArrow -> h (Attr (AttrMapSym1 s) 'RArrow)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'RArrow
 -> h (Apply (AttrMapSym1 s) 'RArrow))
-> Attr (AttrMapSym1 r) 'RArrow -> h (Attr (AttrMapSym1 s) 'RArrow)
forall u (h :: * -> *) (f :: u ~> *) (label :: u) (g :: u ~> *).
Applicative h =>
(Apply f label -> h (Apply g label))
-> Attr f label -> h (Attr g label)
traverseAttr ((r -> h s) -> IpeArrow r -> h (IpeArrow s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse r -> h s
f)
instance TraverseIpeAttr Opacity    where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Opacity
-> h (Attr (AttrMapSym1 s) 'Opacity)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'Opacity -> h (Attr (AttrMapSym1 s) 'Opacity)
forall u (h :: * -> *) (f :: u ~> *) (a :: u) (g :: u ~> *).
(Applicative h, Apply f a ~ Apply g a) =>
Attr f a -> h (Attr g a)
pureAttr
instance TraverseIpeAttr Tiling     where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Tiling -> h (Attr (AttrMapSym1 s) 'Tiling)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'Tiling -> h (Attr (AttrMapSym1 s) 'Tiling)
forall u (h :: * -> *) (f :: u ~> *) (a :: u) (g :: u ~> *).
(Applicative h, Apply f a ~ Apply g a) =>
Attr f a -> h (Attr g a)
pureAttr
instance TraverseIpeAttr Gradient   where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Gradient
-> h (Attr (AttrMapSym1 s) 'Gradient)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'Gradient
-> h (Attr (AttrMapSym1 s) 'Gradient)
forall u (h :: * -> *) (f :: u ~> *) (a :: u) (g :: u ~> *).
(Applicative h, Apply f a ~ Apply g a) =>
Attr f a -> h (Attr g a)
pureAttr


-- GroupAttributeUniverse
instance TraverseIpeAttr Clip     where traverseIpeAttr :: (r -> h s)
-> Attr (AttrMapSym1 r) 'Clip -> h (Attr (AttrMapSym1 s) 'Clip)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Clip -> h (Apply (AttrMapSym1 s) 'Clip))
-> Attr (AttrMapSym1 r) 'Clip -> h (Attr (AttrMapSym1 s) 'Clip)
forall u (h :: * -> *) (f :: u ~> *) (label :: u) (g :: u ~> *).
Applicative h =>
(Apply f label -> h (Apply g label))
-> Attr f label -> h (Attr g label)
traverseAttr ((r -> h s) -> Path r -> h (Path s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse r -> h s
f)

--------------------------------------------------------------------------------
-- | Groups and Objects

--------------------------------------------------------------------------------
-- | Group Attributes

-- -- | Now that we know what a Path is we can define the Attributes of a Group.
-- type family GroupAttrElf (r :: *) (s :: GroupAttributeUniverse) :: * where
--   GroupAttrElf r Clip = Path r -- strictly we event want this to be a closed path I guess

-- genDefunSymbols [''GroupAttrElf]

-- type GroupAttributes r = Attributes (GroupAttrElfSym1 r) '[ 'Clip]


-- | A group is essentially a list of IpeObjects.
newtype Group r = Group [IpeObject r] deriving (Int -> Group r -> ShowS
[Group r] -> ShowS
Group r -> String
(Int -> Group r -> ShowS)
-> (Group r -> String) -> ([Group r] -> ShowS) -> Show (Group r)
forall r. Show r => Int -> Group r -> ShowS
forall r. Show r => [Group r] -> ShowS
forall r. Show r => Group r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Group r] -> ShowS
$cshowList :: forall r. Show r => [Group r] -> ShowS
show :: Group r -> String
$cshow :: forall r. Show r => Group r -> String
showsPrec :: Int -> Group r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> Group r -> ShowS
Show,Group r -> Group r -> Bool
(Group r -> Group r -> Bool)
-> (Group r -> Group r -> Bool) -> Eq (Group r)
forall r. Eq r => Group r -> Group r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Group r -> Group r -> Bool
$c/= :: forall r. Eq r => Group r -> Group r -> Bool
== :: Group r -> Group r -> Bool
$c== :: forall r. Eq r => Group r -> Group r -> Bool
Eq,a -> Group b -> Group a
(a -> b) -> Group a -> Group b
(forall a b. (a -> b) -> Group a -> Group b)
-> (forall a b. a -> Group b -> Group a) -> Functor Group
forall a b. a -> Group b -> Group a
forall a b. (a -> b) -> Group a -> Group b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Group b -> Group a
$c<$ :: forall a b. a -> Group b -> Group a
fmap :: (a -> b) -> Group a -> Group b
$cfmap :: forall a b. (a -> b) -> Group a -> Group b
Functor,Group a -> Bool
(a -> m) -> Group a -> m
(a -> b -> b) -> b -> Group a -> b
(forall m. Monoid m => Group m -> m)
-> (forall m a. Monoid m => (a -> m) -> Group a -> m)
-> (forall m a. Monoid m => (a -> m) -> Group a -> m)
-> (forall a b. (a -> b -> b) -> b -> Group a -> b)
-> (forall a b. (a -> b -> b) -> b -> Group a -> b)
-> (forall b a. (b -> a -> b) -> b -> Group a -> b)
-> (forall b a. (b -> a -> b) -> b -> Group a -> b)
-> (forall a. (a -> a -> a) -> Group a -> a)
-> (forall a. (a -> a -> a) -> Group a -> a)
-> (forall a. Group a -> [a])
-> (forall a. Group a -> Bool)
-> (forall a. Group a -> Int)
-> (forall a. Eq a => a -> Group a -> Bool)
-> (forall a. Ord a => Group a -> a)
-> (forall a. Ord a => Group a -> a)
-> (forall a. Num a => Group a -> a)
-> (forall a. Num a => Group a -> a)
-> Foldable Group
forall a. Eq a => a -> Group a -> Bool
forall a. Num a => Group a -> a
forall a. Ord a => Group a -> a
forall m. Monoid m => Group m -> m
forall a. Group a -> Bool
forall a. Group a -> Int
forall a. Group a -> [a]
forall a. (a -> a -> a) -> Group a -> a
forall m a. Monoid m => (a -> m) -> Group a -> m
forall b a. (b -> a -> b) -> b -> Group a -> b
forall a b. (a -> b -> b) -> b -> Group a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Group a -> a
$cproduct :: forall a. Num a => Group a -> a
sum :: Group a -> a
$csum :: forall a. Num a => Group a -> a
minimum :: Group a -> a
$cminimum :: forall a. Ord a => Group a -> a
maximum :: Group a -> a
$cmaximum :: forall a. Ord a => Group a -> a
elem :: a -> Group a -> Bool
$celem :: forall a. Eq a => a -> Group a -> Bool
length :: Group a -> Int
$clength :: forall a. Group a -> Int
null :: Group a -> Bool
$cnull :: forall a. Group a -> Bool
toList :: Group a -> [a]
$ctoList :: forall a. Group a -> [a]
foldl1 :: (a -> a -> a) -> Group a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Group a -> a
foldr1 :: (a -> a -> a) -> Group a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Group a -> a
foldl' :: (b -> a -> b) -> b -> Group a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Group a -> b
foldl :: (b -> a -> b) -> b -> Group a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Group a -> b
foldr' :: (a -> b -> b) -> b -> Group a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Group a -> b
foldr :: (a -> b -> b) -> b -> Group a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Group a -> b
foldMap' :: (a -> m) -> Group a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Group a -> m
foldMap :: (a -> m) -> Group a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Group a -> m
fold :: Group m -> m
$cfold :: forall m. Monoid m => Group m -> m
Foldable,Functor Group
Foldable Group
Functor Group
-> Foldable Group
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Group a -> f (Group b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Group (f a) -> f (Group a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Group a -> m (Group b))
-> (forall (m :: * -> *) a. Monad m => Group (m a) -> m (Group a))
-> Traversable Group
(a -> f b) -> Group a -> f (Group b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a. Monad m => Group (m a) -> m (Group a)
forall (f :: * -> *) a. Applicative f => Group (f a) -> f (Group a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Group a -> m (Group b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Group a -> f (Group b)
sequence :: Group (m a) -> m (Group a)
$csequence :: forall (m :: * -> *) a. Monad m => Group (m a) -> m (Group a)
mapM :: (a -> m b) -> Group a -> m (Group b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Group a -> m (Group b)
sequenceA :: Group (f a) -> f (Group a)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Group (f a) -> f (Group a)
traverse :: (a -> f b) -> Group a -> f (Group b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Group a -> f (Group b)
$cp2Traversable :: Foldable Group
$cp1Traversable :: Functor Group
Traversable)

type instance NumType   (Group r) = r
type instance Dimension (Group r) = 2

instance Fractional r => IsTransformable (Group r) where
  transformBy :: Transformation (Dimension (Group r)) (NumType (Group r))
-> Group r -> Group r
transformBy Transformation (Dimension (Group r)) (NumType (Group r))
t (Group [IpeObject r]
s) = [IpeObject r] -> Group r
forall r. [IpeObject r] -> Group r
Group ([IpeObject r] -> Group r) -> [IpeObject r] -> Group r
forall a b. (a -> b) -> a -> b
$ (IpeObject r -> IpeObject r) -> [IpeObject r] -> [IpeObject r]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
-> IpeObject r -> IpeObject r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
Transformation (Dimension (Group r)) (NumType (Group r))
t) [IpeObject r]
s


type family AttributesOf (t :: * -> *) :: [AttributeUniverse] where
  AttributesOf Group     = GroupAttributes
  AttributesOf Image     = CommonAttributes
  AttributesOf TextLabel = CommonAttributes
  AttributesOf MiniPage  = CommonAttributes
  AttributesOf IpeSymbol = SymbolAttributes
  AttributesOf Path      = PathAttributes


-- | Attributes' :: * -> [AttributeUniverse] -> *
type Attributes' r = Attributes (AttrMapSym1 r)

type IpeAttributes g r = Attributes' r (AttributesOf g)


-- | An IpeObject' is essentially the oject ogether with its attributes
type IpeObject' g r = g r :+ IpeAttributes g r

attributes :: Lens' (IpeObject' g r) (IpeAttributes g r)
attributes :: (IpeAttributes g r -> f (IpeAttributes g r))
-> IpeObject' g r -> f (IpeObject' g r)
attributes = (IpeAttributes g r -> f (IpeAttributes g r))
-> IpeObject' g r -> f (IpeObject' g r)
forall core extra extra'.
Lens (core :+ extra) (core :+ extra') extra extra'
extra

-- | traverse for ipe attributes
traverseIpeAttrs               :: ( Applicative f
                                  , AllConstrained TraverseIpeAttr (AttributesOf g)
                                  ) => proxy g -> (r -> f s) -> IpeAttributes g r -> f (IpeAttributes g s)
traverseIpeAttrs :: proxy g -> (r -> f s) -> IpeAttributes g r -> f (IpeAttributes g s)
traverseIpeAttrs proxy g
_ r -> f s
f (Attrs Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
ats) = (Rec (Attr (AttrMapSym1 s)) (AttributesOf g) -> IpeAttributes g s)
-> f (Rec (Attr (AttrMapSym1 s)) (AttributesOf g))
-> f (IpeAttributes g s)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Rec (Attr (AttrMapSym1 s)) (AttributesOf g) -> IpeAttributes g s
forall u (f :: TyFun u * -> *) (ats :: [u]).
Rec (Attr f) ats -> Attributes f ats
Attrs (f (Rec (Attr (AttrMapSym1 s)) (AttributesOf g))
 -> f (IpeAttributes g s))
-> (Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
    -> f (Rec (Attr (AttrMapSym1 s)) (AttributesOf g)))
-> Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
-> f (IpeAttributes g s)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (r -> f s)
-> Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
-> f (Rec (Attr (AttrMapSym1 s)) (AttributesOf g))
forall (f :: * -> *) (ats :: [AttributeUniverse]) r s.
(Applicative f, AllConstrained TraverseIpeAttr ats) =>
(r -> f s)
-> Rec (Attr (AttrMapSym1 r)) ats
-> f (Rec (Attr (AttrMapSym1 s)) ats)
traverseIpeAttrs' r -> f s
f (Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
 -> f (IpeAttributes g s))
-> Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
-> f (IpeAttributes g s)
forall a b. (a -> b) -> a -> b
$ Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
ats

traverseIpeAttrs'   :: ( Applicative f
                       , AllConstrained TraverseIpeAttr ats
                       )
                    => (r -> f s)
                    -> Rec (Attr (AttrMapSym1 r)) ats
                    -> f (Rec (Attr (AttrMapSym1 s)) ats)
traverseIpeAttrs' :: (r -> f s)
-> Rec (Attr (AttrMapSym1 r)) ats
-> f (Rec (Attr (AttrMapSym1 s)) ats)
traverseIpeAttrs' r -> f s
f = \case
  Rec (Attr (AttrMapSym1 r)) ats
RNil        -> Rec (Attr (AttrMapSym1 s)) '[]
-> f (Rec (Attr (AttrMapSym1 s)) '[])
forall (f :: * -> *) a. Applicative f => a -> f a
pure Rec (Attr (AttrMapSym1 s)) '[]
forall u (a :: u -> *). Rec a '[]
RNil
  (Attr (AttrMapSym1 r) r
a :& Rec (Attr (AttrMapSym1 r)) rs
ats') -> Attr (AttrMapSym1 s) r
-> Rec (Attr (AttrMapSym1 s)) rs
-> Rec (Attr (AttrMapSym1 s)) (r : rs)
forall u (a :: u -> *) (r :: u) (rs :: [u]).
a r -> Rec a rs -> Rec a (r : rs)
(:&) (Attr (AttrMapSym1 s) r
 -> Rec (Attr (AttrMapSym1 s)) rs
 -> Rec (Attr (AttrMapSym1 s)) (r : rs))
-> f (Attr (AttrMapSym1 s) r)
-> f (Rec (Attr (AttrMapSym1 s)) rs
      -> Rec (Attr (AttrMapSym1 s)) (r : rs))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (r -> f s) -> Attr (AttrMapSym1 r) r -> f (Attr (AttrMapSym1 s) r)
forall (a :: AttributeUniverse) (h :: * -> *) r s.
(TraverseIpeAttr a, Applicative h) =>
(r -> h s) -> Attr (AttrMapSym1 r) a -> h (Attr (AttrMapSym1 s) a)
traverseIpeAttr r -> f s
f Attr (AttrMapSym1 r) r
a f (Rec (Attr (AttrMapSym1 s)) rs
   -> Rec (Attr (AttrMapSym1 s)) (r : rs))
-> f (Rec (Attr (AttrMapSym1 s)) rs)
-> f (Rec (Attr (AttrMapSym1 s)) (r : rs))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (r -> f s)
-> Rec (Attr (AttrMapSym1 r)) rs
-> f (Rec (Attr (AttrMapSym1 s)) rs)
forall (f :: * -> *) (ats :: [AttributeUniverse]) r s.
(Applicative f, AllConstrained TraverseIpeAttr ats) =>
(r -> f s)
-> Rec (Attr (AttrMapSym1 r)) ats
-> f (Rec (Attr (AttrMapSym1 s)) ats)
traverseIpeAttrs' r -> f s
f Rec (Attr (AttrMapSym1 r)) rs
ats'


data IpeObject r =
    IpeGroup     (IpeObject' Group     r)
  | IpeImage     (IpeObject' Image     r)
  | IpeTextLabel (IpeObject' TextLabel r)
  | IpeMiniPage  (IpeObject' MiniPage  r)
  | IpeUse       (IpeObject' IpeSymbol r)
  | IpePath      (IpeObject' Path      r)


traverseIpeObject'              :: forall g r f s. ( Applicative f
                                                   , Traversable g
                                                   , AllConstrained TraverseIpeAttr (AttributesOf  g)
                                                   )
                                => (r -> f s) -> IpeObject' g r -> f (IpeObject' g s)
traverseIpeObject' :: (r -> f s) -> IpeObject' g r -> f (IpeObject' g s)
traverseIpeObject' r -> f s
f (g r
i :+ IpeAttributes g r
ats) = g s -> Attributes' s (AttributesOf g) -> IpeObject' g s
forall core extra. core -> extra -> core :+ extra
(:+) (g s -> Attributes' s (AttributesOf g) -> IpeObject' g s)
-> f (g s) -> f (Attributes' s (AttributesOf g) -> IpeObject' g s)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (r -> f s) -> g r -> f (g s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse r -> f s
f g r
i f (Attributes' s (AttributesOf g) -> IpeObject' g s)
-> f (Attributes' s (AttributesOf g)) -> f (IpeObject' g s)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy g
-> (r -> f s)
-> IpeAttributes g r
-> f (Attributes' s (AttributesOf g))
forall (f :: * -> *) (g :: * -> *) (proxy :: (* -> *) -> *) r s.
(Applicative f, AllConstrained TraverseIpeAttr (AttributesOf g)) =>
proxy g -> (r -> f s) -> IpeAttributes g r -> f (IpeAttributes g s)
traverseIpeAttrs (Proxy g
forall k (t :: k). Proxy t
Proxy @g) r -> f s
f IpeAttributes g r
ats

instance Functor IpeObject where
  fmap :: (a -> b) -> IpeObject a -> IpeObject b
fmap = (a -> b) -> IpeObject a -> IpeObject b
forall (t :: * -> *) a b. Traversable t => (a -> b) -> t a -> t b
fmapDefault
instance Foldable IpeObject where
  foldMap :: (a -> m) -> IpeObject a -> m
foldMap = (a -> m) -> IpeObject a -> m
forall (t :: * -> *) m a.
(Traversable t, Monoid m) =>
(a -> m) -> t a -> m
foldMapDefault
instance Traversable IpeObject where
  traverse :: (a -> f b) -> IpeObject a -> f (IpeObject b)
traverse a -> f b
f = \case
    IpeGroup IpeObject' Group a
g     -> (Group b
 :+ Attributes
      (AttrMapSym1 b) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> IpeObject b
forall r. IpeObject' Group r -> IpeObject r
IpeGroup     ((Group b
  :+ Attributes
       (AttrMapSym1 b) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
 -> IpeObject b)
-> f (Group b
      :+ Attributes
           (AttrMapSym1 b) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> f (IpeObject b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f b) -> IpeObject' Group a -> f (IpeObject' Group b)
forall (g :: * -> *) r (f :: * -> *) s.
(Applicative f, Traversable g,
 AllConstrained TraverseIpeAttr (AttributesOf g)) =>
(r -> f s) -> IpeObject' g r -> f (IpeObject' g s)
traverseIpeObject' a -> f b
f IpeObject' Group a
g
    IpeImage IpeObject' Image a
i     -> (Image b :+ Attributes (AttrMapSym1 b) CommonAttributes)
-> IpeObject b
forall r. IpeObject' Image r -> IpeObject r
IpeImage     ((Image b :+ Attributes (AttrMapSym1 b) CommonAttributes)
 -> IpeObject b)
-> f (Image b :+ Attributes (AttrMapSym1 b) CommonAttributes)
-> f (IpeObject b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f b) -> IpeObject' Image a -> f (IpeObject' Image b)
forall (g :: * -> *) r (f :: * -> *) s.
(Applicative f, Traversable g,
 AllConstrained TraverseIpeAttr (AttributesOf g)) =>
(r -> f s) -> IpeObject' g r -> f (IpeObject' g s)
traverseIpeObject' a -> f b
f IpeObject' Image a
i
    IpeTextLabel IpeObject' TextLabel a
l -> (TextLabel b :+ Attributes (AttrMapSym1 b) CommonAttributes)
-> IpeObject b
forall r. IpeObject' TextLabel r -> IpeObject r
IpeTextLabel ((TextLabel b :+ Attributes (AttrMapSym1 b) CommonAttributes)
 -> IpeObject b)
-> f (TextLabel b :+ Attributes (AttrMapSym1 b) CommonAttributes)
-> f (IpeObject b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f b) -> IpeObject' TextLabel a -> f (IpeObject' TextLabel b)
forall (g :: * -> *) r (f :: * -> *) s.
(Applicative f, Traversable g,
 AllConstrained TraverseIpeAttr (AttributesOf g)) =>
(r -> f s) -> IpeObject' g r -> f (IpeObject' g s)
traverseIpeObject' a -> f b
f IpeObject' TextLabel a
l
    IpeMiniPage IpeObject' MiniPage a
p  -> (MiniPage b :+ Attributes (AttrMapSym1 b) CommonAttributes)
-> IpeObject b
forall r. IpeObject' MiniPage r -> IpeObject r
IpeMiniPage  ((MiniPage b :+ Attributes (AttrMapSym1 b) CommonAttributes)
 -> IpeObject b)
-> f (MiniPage b :+ Attributes (AttrMapSym1 b) CommonAttributes)
-> f (IpeObject b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f b) -> IpeObject' MiniPage a -> f (IpeObject' MiniPage b)
forall (g :: * -> *) r (f :: * -> *) s.
(Applicative f, Traversable g,
 AllConstrained TraverseIpeAttr (AttributesOf g)) =>
(r -> f s) -> IpeObject' g r -> f (IpeObject' g s)
traverseIpeObject' a -> f b
f IpeObject' MiniPage a
p
    IpeUse IpeObject' IpeSymbol a
u       -> (IpeSymbol b
 :+ Attributes
      (AttrMapSym1 b)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
         'Size])
-> IpeObject b
forall r. IpeObject' IpeSymbol r -> IpeObject r
IpeUse       ((IpeSymbol b
  :+ Attributes
       (AttrMapSym1 b)
       '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
          'Size])
 -> IpeObject b)
-> f (IpeSymbol b
      :+ Attributes
           (AttrMapSym1 b)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
              'Size])
-> f (IpeObject b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f b) -> IpeObject' IpeSymbol a -> f (IpeObject' IpeSymbol b)
forall (g :: * -> *) r (f :: * -> *) s.
(Applicative f, Traversable g,
 AllConstrained TraverseIpeAttr (AttributesOf g)) =>
(r -> f s) -> IpeObject' g r -> f (IpeObject' g s)
traverseIpeObject' a -> f b
f IpeObject' IpeSymbol a
u
    IpePath IpeObject' Path a
p      -> (Path b
 :+ Attributes
      (AttrMapSym1 b)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
         'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
         'Tiling, 'Gradient])
-> IpeObject b
forall r. IpeObject' Path r -> IpeObject r
IpePath      ((Path b
  :+ Attributes
       (AttrMapSym1 b)
       '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
          'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
          'Tiling, 'Gradient])
 -> IpeObject b)
-> f (Path b
      :+ Attributes
           (AttrMapSym1 b)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
              'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
              'Tiling, 'Gradient])
-> f (IpeObject b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f b) -> IpeObject' Path a -> f (IpeObject' Path b)
forall (g :: * -> *) r (f :: * -> *) s.
(Applicative f, Traversable g,
 AllConstrained TraverseIpeAttr (AttributesOf g)) =>
(r -> f s) -> IpeObject' g r -> f (IpeObject' g s)
traverseIpeObject' a -> f b
f IpeObject' Path a
p


deriving instance (Show r) => Show (IpeObject r)
-- deriving instance (Read r) => Read (IpeObject r)
deriving instance (Eq r)   => Eq   (IpeObject r)

type instance NumType   (IpeObject r) = r
type instance Dimension (IpeObject r) = 2

makePrisms ''IpeObject

groupItems :: Lens (Group r) (Group s) [IpeObject r] [IpeObject s]
groupItems :: ([IpeObject r] -> f [IpeObject s]) -> Group r -> f (Group s)
groupItems = (Group r -> [IpeObject r])
-> (Group r -> [IpeObject s] -> Group s)
-> Lens (Group r) (Group s) [IpeObject r] [IpeObject s]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens (\(Group [IpeObject r]
xs) -> [IpeObject r]
xs) (([IpeObject s] -> Group s) -> Group r -> [IpeObject s] -> Group s
forall a b. a -> b -> a
const [IpeObject s] -> Group s
forall r. [IpeObject r] -> Group r
Group)

class ToObject i where
  mkIpeObject :: IpeObject' i r -> IpeObject r

instance ToObject Group      where mkIpeObject :: IpeObject' Group r -> IpeObject r
mkIpeObject = IpeObject' Group r -> IpeObject r
forall r. IpeObject' Group r -> IpeObject r
IpeGroup
instance ToObject Image      where mkIpeObject :: IpeObject' Image r -> IpeObject r
mkIpeObject = IpeObject' Image r -> IpeObject r
forall r. IpeObject' Image r -> IpeObject r
IpeImage
instance ToObject TextLabel  where mkIpeObject :: IpeObject' TextLabel r -> IpeObject r
mkIpeObject = IpeObject' TextLabel r -> IpeObject r
forall r. IpeObject' TextLabel r -> IpeObject r
IpeTextLabel
instance ToObject MiniPage   where mkIpeObject :: IpeObject' MiniPage r -> IpeObject r
mkIpeObject = IpeObject' MiniPage r -> IpeObject r
forall r. IpeObject' MiniPage r -> IpeObject r
IpeMiniPage
instance ToObject IpeSymbol  where mkIpeObject :: IpeObject' IpeSymbol r -> IpeObject r
mkIpeObject = IpeObject' IpeSymbol r -> IpeObject r
forall r. IpeObject' IpeSymbol r -> IpeObject r
IpeUse
instance ToObject Path       where mkIpeObject :: IpeObject' Path r -> IpeObject r
mkIpeObject = IpeObject' Path r -> IpeObject r
forall r. IpeObject' Path r -> IpeObject r
IpePath

instance Fractional r => IsTransformable (IpeObject r) where
  transformBy :: Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
-> IpeObject r -> IpeObject r
transformBy Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t (IpeGroup IpeObject' Group r
i)     = IpeObject' Group r -> IpeObject r
forall r. IpeObject' Group r -> IpeObject r
IpeGroup     (IpeObject' Group r -> IpeObject r)
-> IpeObject' Group r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ Group r
:+ Attributes
     (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]
IpeObject' Group r
i(Group r
 :+ Attributes
      (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> ((Group r
     :+ Attributes
          (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
    -> Group r
       :+ Attributes
            (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> Group r
   :+ Attributes
        (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]
forall a b. a -> (a -> b) -> b
&(Group r -> Identity (Group r))
-> (Group r
    :+ Attributes
         (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> Identity
     (Group r
      :+ Attributes
           (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
forall core extra core'.
Lens (core :+ extra) (core' :+ extra) core core'
core ((Group r -> Identity (Group r))
 -> (Group r
     :+ Attributes
          (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
 -> Identity
      (Group r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]))
-> (Group r -> Group r)
-> (Group r
    :+ Attributes
         (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> Group r
   :+ Attributes
        (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Transformation (Dimension (Group r)) (NumType (Group r))
-> Group r -> Group r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
Transformation (Dimension (Group r)) (NumType (Group r))
t
  transformBy Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t (IpeImage IpeObject' Image r
i)     = IpeObject' Image r -> IpeObject r
forall r. IpeObject' Image r -> IpeObject r
IpeImage     (IpeObject' Image r -> IpeObject r)
-> IpeObject' Image r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ Image r :+ Attributes (AttrMapSym1 r) CommonAttributes
IpeObject' Image r
i(Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> ((Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
    -> Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Image r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall a b. a -> (a -> b) -> b
&(Image r -> Identity (Image r))
-> (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Identity
     (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
forall core extra core'.
Lens (core :+ extra) (core' :+ extra) core core'
core ((Image r -> Identity (Image r))
 -> (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
 -> Identity
      (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes))
-> (Image r -> Image r)
-> (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Image r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Transformation (Dimension (Image r)) (NumType (Image r))
-> Image r -> Image r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (Image r)) (NumType (Image r))
Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t
  transformBy Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t (IpeTextLabel IpeObject' TextLabel r
i) = IpeObject' TextLabel r -> IpeObject r
forall r. IpeObject' TextLabel r -> IpeObject r
IpeTextLabel (IpeObject' TextLabel r -> IpeObject r)
-> IpeObject' TextLabel r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes
IpeObject' TextLabel r
i(TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> ((TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
    -> TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall a b. a -> (a -> b) -> b
&(TextLabel r -> Identity (TextLabel r))
-> (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Identity
     (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
forall core extra core'.
Lens (core :+ extra) (core' :+ extra) core core'
core ((TextLabel r -> Identity (TextLabel r))
 -> (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
 -> Identity
      (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes))
-> (TextLabel r -> TextLabel r)
-> (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Transformation (Dimension (TextLabel r)) (NumType (TextLabel r))
-> TextLabel r -> TextLabel r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (TextLabel r)) (NumType (TextLabel r))
Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t
  transformBy Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t (IpeMiniPage IpeObject' MiniPage r
i)  = IpeObject' MiniPage r -> IpeObject r
forall r. IpeObject' MiniPage r -> IpeObject r
IpeMiniPage  (IpeObject' MiniPage r -> IpeObject r)
-> IpeObject' MiniPage r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes
IpeObject' MiniPage r
i(MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> ((MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
    -> MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall a b. a -> (a -> b) -> b
&(MiniPage r -> Identity (MiniPage r))
-> (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Identity
     (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
forall core extra core'.
Lens (core :+ extra) (core' :+ extra) core core'
core ((MiniPage r -> Identity (MiniPage r))
 -> (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
 -> Identity
      (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes))
-> (MiniPage r -> MiniPage r)
-> (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Transformation (Dimension (MiniPage r)) (NumType (MiniPage r))
-> MiniPage r -> MiniPage r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (MiniPage r)) (NumType (MiniPage r))
Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t
  transformBy Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t (IpeUse IpeObject' IpeSymbol r
i)       = IpeObject' IpeSymbol r -> IpeObject r
forall r. IpeObject' IpeSymbol r -> IpeObject r
IpeUse       (IpeObject' IpeSymbol r -> IpeObject r)
-> IpeObject' IpeSymbol r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ IpeSymbol r
:+ Attributes
     (AttrMapSym1 r)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
        'Size]
IpeObject' IpeSymbol r
i(IpeSymbol r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
         'Size])
-> ((IpeSymbol r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
             'Size])
    -> IpeSymbol r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
               'Size])
-> IpeSymbol r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
           'Size]
forall a b. a -> (a -> b) -> b
&(IpeSymbol r -> Identity (IpeSymbol r))
-> (IpeSymbol r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
            'Size])
-> Identity
     (IpeSymbol r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
              'Size])
forall core extra core'.
Lens (core :+ extra) (core' :+ extra) core core'
core ((IpeSymbol r -> Identity (IpeSymbol r))
 -> (IpeSymbol r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
             'Size])
 -> Identity
      (IpeSymbol r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
               'Size]))
-> (IpeSymbol r -> IpeSymbol r)
-> (IpeSymbol r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
            'Size])
-> IpeSymbol r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
           'Size]
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Transformation (Dimension (IpeSymbol r)) (NumType (IpeSymbol r))
-> IpeSymbol r -> IpeSymbol r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (IpeSymbol r)) (NumType (IpeSymbol r))
Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t
  transformBy Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t (IpePath IpeObject' Path r
i)      = IpeObject' Path r -> IpeObject r
forall r. IpeObject' Path r -> IpeObject r
IpePath      (IpeObject' Path r -> IpeObject r)
-> IpeObject' Path r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ Path r
:+ Attributes
     (AttrMapSym1 r)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
        'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
        'Tiling, 'Gradient]
IpeObject' Path r
i(Path r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
         'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
         'Tiling, 'Gradient])
-> ((Path r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
             'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
             'Tiling, 'Gradient])
    -> Path r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
               'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
               'Tiling, 'Gradient])
-> Path r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
           'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
           'Tiling, 'Gradient]
forall a b. a -> (a -> b) -> b
&(Path r -> Identity (Path r))
-> (Path r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
            'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
            'Tiling, 'Gradient])
-> Identity
     (Path r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
              'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
              'Tiling, 'Gradient])
forall core extra core'.
Lens (core :+ extra) (core' :+ extra) core core'
core ((Path r -> Identity (Path r))
 -> (Path r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
             'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
             'Tiling, 'Gradient])
 -> Identity
      (Path r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
               'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
               'Tiling, 'Gradient]))
-> (Path r -> Path r)
-> (Path r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
            'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
            'Tiling, 'Gradient])
-> Path r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
           'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
           'Tiling, 'Gradient]
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ Transformation (Dimension (Path r)) (NumType (Path r))
-> Path r -> Path r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (Path r)) (NumType (Path r))
Transformation (Dimension (IpeObject r)) (NumType (IpeObject r))
t

-- | Shorthand for constructing ipeObjects
ipeObject'     :: ToObject i => i r -> IpeAttributes i r -> IpeObject r
ipeObject' :: i r -> IpeAttributes i r -> IpeObject r
ipeObject' i r
i IpeAttributes i r
a = IpeObject' i r -> IpeObject r
forall (i :: * -> *) r. ToObject i => IpeObject' i r -> IpeObject r
mkIpeObject (IpeObject' i r -> IpeObject r) -> IpeObject' i r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ i r
i i r -> IpeAttributes i r -> IpeObject' i r
forall core extra. core -> extra -> core :+ extra
:+ IpeAttributes i r
a

commonAttributes :: Lens' (IpeObject r) (Attributes (AttrMapSym1 r) CommonAttributes)
commonAttributes :: (Attributes (AttrMapSym1 r) CommonAttributes
 -> f (Attributes (AttrMapSym1 r) CommonAttributes))
-> IpeObject r -> f (IpeObject r)
commonAttributes = (IpeObject r -> Attributes (AttrMapSym1 r) CommonAttributes)
-> (IpeObject r
    -> Attributes (AttrMapSym1 r) CommonAttributes -> IpeObject r)
-> Lens
     (IpeObject r)
     (IpeObject r)
     (Attributes (AttrMapSym1 r) CommonAttributes)
     (Attributes (AttrMapSym1 r) CommonAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens (Rec (Attr (AttrMapSym1 r)) CommonAttributes
-> Attributes (AttrMapSym1 r) CommonAttributes
forall u (f :: TyFun u * -> *) (ats :: [u]).
Rec (Attr f) ats -> Attributes f ats
Attrs (Rec (Attr (AttrMapSym1 r)) CommonAttributes
 -> Attributes (AttrMapSym1 r) CommonAttributes)
-> (IpeObject r -> Rec (Attr (AttrMapSym1 r)) CommonAttributes)
-> IpeObject r
-> Attributes (AttrMapSym1 r) CommonAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IpeObject r -> Rec (Attr (AttrMapSym1 r)) CommonAttributes
forall r.
IpeObject r -> Rec (Attr (AttrMapSym1 r)) CommonAttributes
g) (\IpeObject r
x (Attrs Rec (Attr (AttrMapSym1 r)) CommonAttributes
a) -> IpeObject r
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes -> IpeObject r
forall r.
IpeObject r
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes -> IpeObject r
s IpeObject r
x Rec (Attr (AttrMapSym1 r)) CommonAttributes
a)
  where
    select :: (CommonAttributes  AttributesOf g) =>
              Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
    select :: Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select = (Attributes (AttrMapSym1 r) (AttributesOf g)
 -> f (Attributes (AttrMapSym1 r) (AttributesOf g)))
-> IpeObject' g r -> f (IpeObject' g r)
forall (g :: * -> *) r. Lens' (IpeObject' g r) (IpeAttributes g r)
attributes((Attributes (AttrMapSym1 r) (AttributesOf g)
  -> f (Attributes (AttrMapSym1 r) (AttributesOf g)))
 -> IpeObject' g r -> f (IpeObject' g r))
-> ((Rec (Attr (AttrMapSym1 r)) CommonAttributes
     -> f (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
    -> Attributes (AttrMapSym1 r) (AttributesOf g)
    -> f (Attributes (AttrMapSym1 r) (AttributesOf g)))
-> (Rec (Attr (AttrMapSym1 r)) CommonAttributes
    -> f (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
-> IpeObject' g r
-> f (IpeObject' g r)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
 -> f (Rec (Attr (AttrMapSym1 r)) (AttributesOf g)))
-> Attributes (AttrMapSym1 r) (AttributesOf g)
-> f (Attributes (AttrMapSym1 r) (AttributesOf g))
forall u1 u2 (f :: TyFun u1 * -> *) (ats :: [u1])
       (f' :: TyFun u2 * -> *) (ats' :: [u2]).
Lens
  (Attributes f ats)
  (Attributes f' ats')
  (Rec (Attr f) ats)
  (Rec (Attr f') ats')
unAttrs((Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
  -> f (Rec (Attr (AttrMapSym1 r)) (AttributesOf g)))
 -> Attributes (AttrMapSym1 r) (AttributesOf g)
 -> f (Attributes (AttrMapSym1 r) (AttributesOf g)))
-> ((Rec (Attr (AttrMapSym1 r)) CommonAttributes
     -> f (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
    -> Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
    -> f (Rec (Attr (AttrMapSym1 r)) (AttributesOf g)))
-> (Rec (Attr (AttrMapSym1 r)) CommonAttributes
    -> f (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
-> Attributes (AttrMapSym1 r) (AttributesOf g)
-> f (Attributes (AttrMapSym1 r) (AttributesOf g))
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Rec (Attr (AttrMapSym1 r)) CommonAttributes
 -> f (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
-> Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
-> f (Rec (Attr (AttrMapSym1 r)) (AttributesOf g))
forall k1 k2 (rs :: [k2]) (ss :: [k2]) (f :: k1 -> *) (g :: * -> *)
       (record :: (k1 -> *) -> [k2] -> *) (is :: [Nat]).
(RecSubset record rs ss is, Functor g, RecSubsetFCtx record f) =>
(record f rs -> g (record f rs)) -> record f ss -> g (record f ss)
rsubset

    g :: IpeObject r -> Rec (Attr (AttrMapSym1 r)) CommonAttributes
g (IpeGroup IpeObject' Group r
i)     = Group r
:+ Attributes
     (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]
IpeObject' Group r
i(Group r
 :+ Attributes
      (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> Getting
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
     (Group r
      :+ Attributes
           (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
  (Group r
   :+ Attributes
        (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select
    g (IpeImage IpeObject' Image r
i)     = Image r :+ Attributes (AttrMapSym1 r) CommonAttributes
IpeObject' Image r
i(Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Getting
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
     (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
  (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select
    g (IpeTextLabel IpeObject' TextLabel r
i) = TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes
IpeObject' TextLabel r
i(TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Getting
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
     (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
  (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select
    g (IpeMiniPage IpeObject' MiniPage r
i)  = MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes
IpeObject' MiniPage r
i(MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Getting
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
     (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
  (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select
    g (IpeUse IpeObject' IpeSymbol r
i)       = IpeSymbol r
:+ Attributes
     (AttrMapSym1 r)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
        'Size]
IpeObject' IpeSymbol r
i(IpeSymbol r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
         'Size])
-> Getting
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
     (IpeSymbol r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
              'Size])
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
  (IpeSymbol r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
           'Size])
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select
    g (IpePath IpeObject' Path r
i)      = Path r
:+ Attributes
     (AttrMapSym1 r)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
        'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
        'Tiling, 'Gradient]
IpeObject' Path r
i(Path r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
         'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
         'Tiling, 'Gradient])
-> Getting
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
     (Path r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
              'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
              'Tiling, 'Gradient])
     (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
  (Path r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
           'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
           'Tiling, 'Gradient])
  (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select

    s :: IpeObject r
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes -> IpeObject r
s (IpeGroup IpeObject' Group r
i)     Rec (Attr (AttrMapSym1 r)) CommonAttributes
a = IpeObject' Group r -> IpeObject r
forall r. IpeObject' Group r -> IpeObject r
IpeGroup     (IpeObject' Group r -> IpeObject r)
-> IpeObject' Group r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ Group r
:+ Attributes
     (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]
IpeObject' Group r
i(Group r
 :+ Attributes
      (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> ((Group r
     :+ Attributes
          (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
    -> Group r
       :+ Attributes
            (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> Group r
   :+ Attributes
        (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) CommonAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
-> (Group r
    :+ Attributes
         (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> Identity
     (Group r
      :+ Attributes
           (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select ((Rec (Attr (AttrMapSym1 r)) CommonAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
 -> (Group r
     :+ Attributes
          (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
 -> Identity
      (Group r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]))
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
-> (Group r
    :+ Attributes
         (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
-> Group r
   :+ Attributes
        (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rec (Attr (AttrMapSym1 r)) CommonAttributes
a
    s (IpeImage IpeObject' Image r
i)     Rec (Attr (AttrMapSym1 r)) CommonAttributes
a = IpeObject' Image r -> IpeObject r
forall r. IpeObject' Image r -> IpeObject r
IpeImage     (IpeObject' Image r -> IpeObject r)
-> IpeObject' Image r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ Image r :+ Attributes (AttrMapSym1 r) CommonAttributes
IpeObject' Image r
i(Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> ((Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
    -> Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Image r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) CommonAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
-> (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Identity
     (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select ((Rec (Attr (AttrMapSym1 r)) CommonAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
 -> (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
 -> Identity
      (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes))
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
-> (Image r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Image r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rec (Attr (AttrMapSym1 r)) CommonAttributes
a
    s (IpeTextLabel IpeObject' TextLabel r
i) Rec (Attr (AttrMapSym1 r)) CommonAttributes
a = IpeObject' TextLabel r -> IpeObject r
forall r. IpeObject' TextLabel r -> IpeObject r
IpeTextLabel (IpeObject' TextLabel r -> IpeObject r)
-> IpeObject' TextLabel r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes
IpeObject' TextLabel r
i(TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> ((TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
    -> TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) CommonAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
-> (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Identity
     (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select ((Rec (Attr (AttrMapSym1 r)) CommonAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
 -> (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
 -> Identity
      (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes))
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
-> (TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> TextLabel r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rec (Attr (AttrMapSym1 r)) CommonAttributes
a
    s (IpeMiniPage IpeObject' MiniPage r
i)  Rec (Attr (AttrMapSym1 r)) CommonAttributes
a = IpeObject' MiniPage r -> IpeObject r
forall r. IpeObject' MiniPage r -> IpeObject r
IpeMiniPage  (IpeObject' MiniPage r -> IpeObject r)
-> IpeObject' MiniPage r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes
IpeObject' MiniPage r
i(MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> ((MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
    -> MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) CommonAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
-> (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> Identity
     (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select ((Rec (Attr (AttrMapSym1 r)) CommonAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
 -> (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
 -> Identity
      (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes))
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
-> (MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes)
-> MiniPage r :+ Attributes (AttrMapSym1 r) CommonAttributes
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rec (Attr (AttrMapSym1 r)) CommonAttributes
a
    s (IpeUse IpeObject' IpeSymbol r
i)       Rec (Attr (AttrMapSym1 r)) CommonAttributes
a = IpeObject' IpeSymbol r -> IpeObject r
forall r. IpeObject' IpeSymbol r -> IpeObject r
IpeUse       (IpeObject' IpeSymbol r -> IpeObject r)
-> IpeObject' IpeSymbol r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ IpeSymbol r
:+ Attributes
     (AttrMapSym1 r)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
        'Size]
IpeObject' IpeSymbol r
i(IpeSymbol r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
         'Size])
-> ((IpeSymbol r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
             'Size])
    -> IpeSymbol r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
               'Size])
-> IpeSymbol r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
           'Size]
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) CommonAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
-> (IpeSymbol r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
            'Size])
-> Identity
     (IpeSymbol r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
              'Size])
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select ((Rec (Attr (AttrMapSym1 r)) CommonAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
 -> (IpeSymbol r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
             'Size])
 -> Identity
      (IpeSymbol r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
               'Size]))
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
-> (IpeSymbol r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
            'Size])
-> IpeSymbol r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
           'Size]
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rec (Attr (AttrMapSym1 r)) CommonAttributes
a
    s (IpePath IpeObject' Path r
i)      Rec (Attr (AttrMapSym1 r)) CommonAttributes
a = IpeObject' Path r -> IpeObject r
forall r. IpeObject' Path r -> IpeObject r
IpePath      (IpeObject' Path r -> IpeObject r)
-> IpeObject' Path r -> IpeObject r
forall a b. (a -> b) -> a -> b
$ Path r
:+ Attributes
     (AttrMapSym1 r)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
        'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
        'Tiling, 'Gradient]
IpeObject' Path r
i(Path r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
         'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
         'Tiling, 'Gradient])
-> ((Path r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
             'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
             'Tiling, 'Gradient])
    -> Path r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
               'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
               'Tiling, 'Gradient])
-> Path r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
           'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
           'Tiling, 'Gradient]
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) CommonAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
-> (Path r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
            'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
            'Tiling, 'Gradient])
-> Identity
     (Path r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
              'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
              'Tiling, 'Gradient])
forall (g :: * -> *) r.
(CommonAttributes ⊆ AttributesOf g) =>
Lens'
  (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
select ((Rec (Attr (AttrMapSym1 r)) CommonAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) CommonAttributes))
 -> (Path r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
             'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
             'Tiling, 'Gradient])
 -> Identity
      (Path r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
               'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
               'Tiling, 'Gradient]))
-> Rec (Attr (AttrMapSym1 r)) CommonAttributes
-> (Path r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
            'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
            'Tiling, 'Gradient])
-> Path r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
           'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow, 'Opacity,
           'Tiling, 'Gradient]
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rec (Attr (AttrMapSym1 r)) CommonAttributes
a

-- | collect all non-group objects
flattenGroups :: [IpeObject r] -> [IpeObject r]
flattenGroups :: [IpeObject r] -> [IpeObject r]
flattenGroups = (IpeObject r -> [IpeObject r]) -> [IpeObject r] -> [IpeObject r]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap IpeObject r -> [IpeObject r]
forall r. IpeObject r -> [IpeObject r]
flattenGroups'
  where
    flattenGroups'                              :: IpeObject r -> [IpeObject r]
    flattenGroups' :: IpeObject r -> [IpeObject r]
flattenGroups' (IpeGroup (Group [IpeObject r]
gs :+ IpeAttributes Group r
ats)) =
      (IpeObject r -> IpeObject r) -> [IpeObject r] -> [IpeObject r]
forall a b. (a -> b) -> [a] -> [b]
map (Attributes' r '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]
-> IpeObject r -> IpeObject r
forall p a. p -> a -> a
applyAts Attributes' r '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip]
IpeAttributes Group r
ats) ([IpeObject r] -> [IpeObject r])
-> ([IpeObject r] -> [IpeObject r])
-> [IpeObject r]
-> [IpeObject r]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (IpeObject r -> [IpeObject r]) -> [IpeObject r] -> [IpeObject r]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap IpeObject r -> [IpeObject r]
forall r. IpeObject r -> [IpeObject r]
flattenGroups' ([IpeObject r] -> [IpeObject r]) -> [IpeObject r] -> [IpeObject r]
forall a b. (a -> b) -> a -> b
$ [IpeObject r]
gs
        where
          applyAts :: p -> a -> a
applyAts p
_ = a -> a
forall a. a -> a
id
    flattenGroups' IpeObject r
o                            = [IpeObject r
o]