{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}
module Ipe.Content(
    Image(Image), imageData, imageRect
  , 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, mapIpeAttrs, traverseIpeAttrs
  , commonAttributes

  , flattenGroups
  ) where

import           Control.Lens hiding (views, elements)
import           Data.Kind
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)
import           GHC.Generics (Generic)
import           HGeometry.Box (Rectangle)
import           HGeometry.Ext
import           HGeometry.Matrix
import           HGeometry.Point
import           HGeometry.Properties
import           HGeometry.Transformation
import qualified Ipe.Attributes as AT
import           Ipe.Attributes hiding (Matrix)
import           Ipe.Color
import           Ipe.Layer
import           Ipe.Path


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

-- | bitmap image objects in Ipe
data Image r = Image { forall r. Image r -> ()
_imageData :: ()
                     , forall r. Image r -> Rectangle (Point 2 r)
_imageRect      :: Rectangle (Point 2 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
$cshowsPrec :: forall r. Show r => Int -> Image r -> ShowS
showsPrec :: Int -> Image r -> ShowS
$cshow :: forall r. Show r => Image r -> String
show :: Image r -> String
$cshowList :: forall r. Show r => [Image r] -> ShowS
showList :: [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
$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
/= :: 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
$ccompare :: forall r. Ord r => Image r -> Image r -> Ordering
compare :: Image r -> Image r -> Ordering
$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
>= :: Image r -> Image r -> Bool
$cmax :: forall r. Ord r => Image r -> Image r -> Image r
max :: Image r -> Image r -> Image r
$cmin :: forall r. Ord r => Image r -> Image r -> Image r
min :: Image r -> Image r -> Image r
Ord,(forall x. Image r -> Rep (Image r) x)
-> (forall x. Rep (Image r) x -> Image r) -> Generic (Image r)
forall x. Rep (Image r) x -> Image r
forall x. Image r -> Rep (Image r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (Image r) x -> Image r
forall r x. Image r -> Rep (Image r) x
$cfrom :: forall r x. Image r -> Rep (Image r) x
from :: forall x. Image r -> Rep (Image r) x
$cto :: forall r x. Rep (Image r) x -> Image r
to :: forall x. Rep (Image r) x -> Image r
Generic)

-- | Lens to access the image data
imageData :: Lens' (Image r) ()
imageData :: forall r (f :: * -> *).
Functor f =>
(() -> f ()) -> Image r -> f (Image r)
imageData () -> f ()
f (Image ()
i Rectangle (Point 2 r)
r) = (() -> Image r) -> f () -> f (Image r)
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\()
i' -> () -> Rectangle (Point 2 r) -> Image r
forall r. () -> Rectangle (Point 2 r) -> Image r
Image ()
i' Rectangle (Point 2 r)
r) (() -> f ()
f ()
i)
{-# INLINE imageData #-}

-- | Lens to access the rectangle of the image
imageRect :: Lens (Image r) (Image r') (Rectangle (Point 2 r)) (Rectangle (Point 2 r'))
imageRect :: forall r r' (f :: * -> *).
Functor f =>
(Rectangle (Point 2 r) -> f (Rectangle (Point 2 r')))
-> Image r -> f (Image r')
imageRect Rectangle (Point 2 r) -> f (Rectangle (Point 2 r'))
f (Image ()
i Rectangle (Point 2 r)
r) = (Rectangle (Point 2 r') -> Image r')
-> f (Rectangle (Point 2 r')) -> f (Image r')
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Rectangle (Point 2 r')
r' -> () -> Rectangle (Point 2 r') -> Image r'
forall r. () -> Rectangle (Point 2 r) -> Image r
Image ()
i Rectangle (Point 2 r')
r') (Rectangle (Point 2 r) -> f (Rectangle (Point 2 r'))
f Rectangle (Point 2 r)
r)
{-# INLINE imageRect #-}

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 (Point 2 r)) (Rectangle (Point 2 r))
-> (Rectangle (Point 2 r) -> Rectangle (Point 2 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 (Point 2 r)) (Rectangle (Point 2 r))
forall r r' (f :: * -> *).
Functor f =>
(Rectangle (Point 2 r) -> f (Rectangle (Point 2 r')))
-> Image r -> f (Image r')
imageRect (Transformation
  (Dimension (Rectangle (Point 2 r)))
  (NumType (Rectangle (Point 2 r)))
-> Rectangle (Point 2 r) -> Rectangle (Point 2 r)
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation
  (Dimension (Rectangle (Point 2 r)))
  (NumType (Rectangle (Point 2 r)))
Transformation (Dimension (Image r)) (NumType (Image r))
t)

instance Functor Image where
  fmap :: forall a b. (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 :: forall m a. Monoid m => (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 :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Image a -> f (Image b)
traverse a -> f b
f (Image ()
d Rectangle (Point 2 a)
r) = () -> Rectangle (Point 2 b) -> Image b
forall r. () -> Rectangle (Point 2 r) -> Image r
Image ()
d (Rectangle (Point 2 b) -> Image b)
-> f (Rectangle (Point 2 b)) -> f (Image b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Point 2 a -> f (Point 2 b))
-> Rectangle (Point 2 a) -> f (Rectangle (Point 2 b))
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Box a -> f (Box b)
traverse (ATraversal (Point 2 a) (Point 2 b) a b
-> Traversal (Point 2 a) (Point 2 b) a b
forall s t a b. ATraversal s t a b -> Traversal s t a b
cloneTraversal ATraversal (Point 2 a) (Point 2 b) a b
(NumType (Point 2 a) -> Bazaar (->) a b (NumType (Point 2 b)))
-> Point 2 a -> Bazaar (->) a b (Point 2 b)
forall point point'.
HasCoordinates point point' =>
IndexedTraversal1 Int point point' (NumType point) (NumType point')
IndexedTraversal1
  Int
  (Point 2 a)
  (Point 2 b)
  (NumType (Point 2 a))
  (NumType (Point 2 b))
coordinates a -> f b
f) Rectangle (Point 2 a)
r

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

-- | A text label
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
$cshowsPrec :: forall r. Show r => Int -> TextLabel r -> ShowS
showsPrec :: Int -> TextLabel r -> ShowS
$cshow :: forall r. Show r => TextLabel r -> String
show :: TextLabel r -> String
$cshowList :: forall r. Show r => [TextLabel r] -> ShowS
showList :: [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
$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
/= :: 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
$ccompare :: forall r. Ord r => TextLabel r -> TextLabel r -> Ordering
compare :: TextLabel r -> TextLabel r -> Ordering
$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
>= :: TextLabel r -> TextLabel r -> Bool
$cmax :: forall r. Ord r => TextLabel r -> TextLabel r -> TextLabel r
max :: TextLabel r -> TextLabel r -> TextLabel r
$cmin :: forall r. Ord r => TextLabel r -> TextLabel r -> TextLabel r
min :: TextLabel r -> TextLabel r -> TextLabel r
Ord,(forall x. TextLabel r -> Rep (TextLabel r) x)
-> (forall x. Rep (TextLabel r) x -> TextLabel r)
-> Generic (TextLabel r)
forall x. Rep (TextLabel r) x -> TextLabel r
forall x. TextLabel r -> Rep (TextLabel r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (TextLabel r) x -> TextLabel r
forall r x. TextLabel r -> Rep (TextLabel r) x
$cfrom :: forall r x. TextLabel r -> Rep (TextLabel r) x
from :: forall x. TextLabel r -> Rep (TextLabel r) x
$cto :: forall r x. Rep (TextLabel r) x -> TextLabel r
to :: forall x. Rep (TextLabel r) x -> TextLabel r
Generic)

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

instance Functor TextLabel  where fmap :: forall a b. (a -> b) -> TextLabel a -> TextLabel b
fmap = (a -> b) -> TextLabel a -> TextLabel b
forall (t :: * -> *) a b. Traversable t => (a -> b) -> t a -> t b
fmapDefault
instance Foldable TextLabel where foldMap :: forall m a. Monoid m => (a -> m) -> TextLabel a -> m
foldMap = (a -> m) -> TextLabel a -> m
forall (t :: * -> *) m a.
(Traversable t, Monoid m) =>
(a -> m) -> t a -> m
foldMapDefault
instance Traversable TextLabel where
  traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TextLabel a -> f (TextLabel b)
traverse a -> f b
f (Label Text
t Point 2 a
p) = let coordinates' :: (NumType (Point 2 a) -> f (NumType (Point 2 b)))
-> Point 2 a -> f (Point 2 b)
coordinates' = ATraversal
  (Point 2 a) (Point 2 b) (NumType (Point 2 a)) (NumType (Point 2 b))
-> Traversal
     (Point 2 a) (Point 2 b) (NumType (Point 2 a)) (NumType (Point 2 b))
forall s t a b. ATraversal s t a b -> Traversal s t a b
cloneTraversal ATraversal
  (Point 2 a) (Point 2 b) (NumType (Point 2 a)) (NumType (Point 2 b))
forall point point'.
HasCoordinates point point' =>
IndexedTraversal1 Int point point' (NumType point) (NumType point')
IndexedTraversal1
  Int
  (Point 2 a)
  (Point 2 b)
  (NumType (Point 2 a))
  (NumType (Point 2 b))
coordinates
                           in Text -> Point 2 b -> TextLabel b
forall r. Text -> Point 2 r -> TextLabel r
Label Text
t (Point 2 b -> TextLabel b) -> f (Point 2 b) -> f (TextLabel b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (NumType (Point 2 a) -> f (NumType (Point 2 b)))
-> Point 2 a -> f (Point 2 b)
coordinates' a -> f b
NumType (Point 2 a) -> f (NumType (Point 2 b))
f Point 2 a
p

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)


-- | A Minipage
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
$cshowsPrec :: forall r. Show r => Int -> MiniPage r -> ShowS
showsPrec :: Int -> MiniPage r -> ShowS
$cshow :: forall r. Show r => MiniPage r -> String
show :: MiniPage r -> String
$cshowList :: forall r. Show r => [MiniPage r] -> ShowS
showList :: [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
$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
/= :: 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
$ccompare :: forall r. Ord r => MiniPage r -> MiniPage r -> Ordering
compare :: MiniPage r -> MiniPage r -> Ordering
$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
>= :: MiniPage r -> MiniPage r -> Bool
$cmax :: forall r. Ord r => MiniPage r -> MiniPage r -> MiniPage r
max :: MiniPage r -> MiniPage r -> MiniPage r
$cmin :: forall r. Ord r => MiniPage r -> MiniPage r -> MiniPage r
min :: MiniPage r -> MiniPage r -> MiniPage r
Ord,(forall x. MiniPage r -> Rep (MiniPage r) x)
-> (forall x. Rep (MiniPage r) x -> MiniPage r)
-> Generic (MiniPage r)
forall x. Rep (MiniPage r) x -> MiniPage r
forall x. MiniPage r -> Rep (MiniPage r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (MiniPage r) x -> MiniPage r
forall r x. MiniPage r -> Rep (MiniPage r) x
$cfrom :: forall r x. MiniPage r -> Rep (MiniPage r) x
from :: forall x. MiniPage r -> Rep (MiniPage r) x
$cto :: forall r x. Rep (MiniPage r) x -> MiniPage r
to :: forall x. Rep (MiniPage r) x -> MiniPage r
Generic)

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

instance Functor MiniPage  where fmap :: forall a b. (a -> b) -> MiniPage a -> MiniPage b
fmap = (a -> b) -> MiniPage a -> MiniPage b
forall (t :: * -> *) a b. Traversable t => (a -> b) -> t a -> t b
fmapDefault
instance Foldable MiniPage where foldMap :: forall m a. Monoid m => (a -> m) -> MiniPage a -> m
foldMap = (a -> m) -> MiniPage a -> m
forall (t :: * -> *) m a.
(Traversable t, Monoid m) =>
(a -> m) -> t a -> m
foldMapDefault
instance Traversable MiniPage where
  traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> MiniPage a -> f (MiniPage b)
traverse a -> f b
f (MiniPage Text
t Point 2 a
p a
w) = let coordinates' :: (NumType (Point 2 a) -> f (NumType (Point 2 b)))
-> Point 2 a -> f (Point 2 b)
coordinates' = ATraversal
  (Point 2 a) (Point 2 b) (NumType (Point 2 a)) (NumType (Point 2 b))
-> Traversal
     (Point 2 a) (Point 2 b) (NumType (Point 2 a)) (NumType (Point 2 b))
forall s t a b. ATraversal s t a b -> Traversal s t a b
cloneTraversal ATraversal
  (Point 2 a) (Point 2 b) (NumType (Point 2 a)) (NumType (Point 2 b))
forall point point'.
HasCoordinates point point' =>
IndexedTraversal1 Int point point' (NumType point) (NumType point')
IndexedTraversal1
  Int
  (Point 2 a)
  (Point 2 b)
  (NumType (Point 2 a))
  (NumType (Point 2 b))
coordinates
                                in Text -> Point 2 b -> b -> MiniPage b
forall r. Text -> Point 2 r -> r -> MiniPage r
MiniPage Text
t (Point 2 b -> b -> MiniPage b)
-> f (Point 2 b) -> f (b -> MiniPage b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (NumType (Point 2 a) -> f (NumType (Point 2 b)))
-> Point 2 a -> f (Point 2 b)
coordinates' a -> f b
NumType (Point 2 a) -> f (NumType (Point 2 b))
f Point 2 a
p f (b -> MiniPage b) -> f b -> f (MiniPage b)
forall a b. f (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
w

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 :: forall t. 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 { forall r. IpeSymbol r -> Point 2 r
_symbolPoint :: Point 2 r
                          , forall 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
$cshowsPrec :: forall r. Show r => Int -> IpeSymbol r -> ShowS
showsPrec :: Int -> IpeSymbol r -> ShowS
$cshow :: forall r. Show r => IpeSymbol r -> String
show :: IpeSymbol r -> String
$cshowList :: forall r. Show r => [IpeSymbol r] -> ShowS
showList :: [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
$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
/= :: 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
$ccompare :: forall r. Ord r => IpeSymbol r -> IpeSymbol r -> Ordering
compare :: IpeSymbol r -> IpeSymbol r -> Ordering
$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
>= :: IpeSymbol r -> IpeSymbol r -> Bool
$cmax :: forall r. Ord r => IpeSymbol r -> IpeSymbol r -> IpeSymbol r
max :: IpeSymbol r -> IpeSymbol r -> IpeSymbol r
$cmin :: forall r. Ord r => IpeSymbol r -> IpeSymbol r -> IpeSymbol r
min :: IpeSymbol r -> IpeSymbol r -> IpeSymbol r
Ord,(forall x. IpeSymbol r -> Rep (IpeSymbol r) x)
-> (forall x. Rep (IpeSymbol r) x -> IpeSymbol r)
-> Generic (IpeSymbol r)
forall x. Rep (IpeSymbol r) x -> IpeSymbol r
forall x. IpeSymbol r -> Rep (IpeSymbol r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (IpeSymbol r) x -> IpeSymbol r
forall r x. IpeSymbol r -> Rep (IpeSymbol r) x
$cfrom :: forall r x. IpeSymbol r -> Rep (IpeSymbol r) x
from :: forall x. IpeSymbol r -> Rep (IpeSymbol r) x
$cto :: forall r x. Rep (IpeSymbol r) x -> IpeSymbol r
to :: forall x. Rep (IpeSymbol r) x -> IpeSymbol r
Generic)

-- | Lens to access the position of the symbol
symbolPoint :: Lens (IpeSymbol r) (IpeSymbol r') (Point 2 r) (Point 2 r')
symbolPoint :: forall r r' (f :: * -> *).
Functor f =>
(Point 2 r -> f (Point 2 r')) -> IpeSymbol r -> f (IpeSymbol r')
symbolPoint Point 2 r -> f (Point 2 r')
f (Symbol Point 2 r
p Text
n) = (Point 2 r' -> IpeSymbol r') -> f (Point 2 r') -> f (IpeSymbol r')
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Point 2 r'
p' -> Point 2 r' -> Text -> IpeSymbol r'
forall r. Point 2 r -> Text -> IpeSymbol r
Symbol Point 2 r'
p' Text
n) (Point 2 r -> f (Point 2 r')
f Point 2 r
p)
{-# INLINE symbolPoint #-}

-- | Lens to access the name of the symbol
symbolName :: Lens' (IpeSymbol r) Text
symbolName :: forall r (f :: * -> *).
Functor f =>
(Text -> f Text) -> IpeSymbol r -> f (IpeSymbol r)
symbolName Text -> f Text
f (Symbol Point 2 r
p Text
n) = (Text -> IpeSymbol r) -> f Text -> f (IpeSymbol r)
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Text
n' -> Point 2 r -> Text -> IpeSymbol r
forall r. Point 2 r -> Text -> IpeSymbol r
Symbol Point 2 r
p Text
n') (Text -> f Text
f Text
n)
{-# INLINE symbolName #-}


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

instance Functor IpeSymbol  where fmap :: forall a b. (a -> b) -> IpeSymbol a -> IpeSymbol b
fmap = (a -> b) -> IpeSymbol a -> IpeSymbol b
forall (t :: * -> *) a b. Traversable t => (a -> b) -> t a -> t b
fmapDefault
instance Foldable IpeSymbol where foldMap :: forall m a. Monoid m => (a -> m) -> IpeSymbol a -> m
foldMap = (a -> m) -> IpeSymbol a -> m
forall (t :: * -> *) m a.
(Traversable t, Monoid m) =>
(a -> m) -> t a -> m
foldMapDefault
instance Traversable IpeSymbol where
  traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> IpeSymbol a -> f (IpeSymbol b)
traverse a -> f b
f (Symbol Point 2 a
p Text
t) = let coordinates' :: (NumType (Point 2 a) -> f (NumType (Point 2 b)))
-> Point 2 a -> f (Point 2 b)
coordinates' = ATraversal
  (Point 2 a) (Point 2 b) (NumType (Point 2 a)) (NumType (Point 2 b))
-> Traversal
     (Point 2 a) (Point 2 b) (NumType (Point 2 a)) (NumType (Point 2 b))
forall s t a b. ATraversal s t a b -> Traversal s t a b
cloneTraversal ATraversal
  (Point 2 a) (Point 2 b) (NumType (Point 2 a)) (NumType (Point 2 b))
forall point point'.
HasCoordinates point point' =>
IndexedTraversal1 Int point point' (NumType point) (NumType point')
IndexedTraversal1
  Int
  (Point 2 a)
  (Point 2 b)
  (NumType (Point 2 a))
  (NumType (Point 2 b))
coordinates
                            in (Point 2 b -> Text -> IpeSymbol b)
-> Text -> Point 2 b -> IpeSymbol b
forall a b c. (a -> b -> c) -> b -> a -> c
flip Point 2 b -> Text -> IpeSymbol b
forall r. Point 2 r -> Text -> IpeSymbol r
Symbol Text
t (Point 2 b -> IpeSymbol b) -> f (Point 2 b) -> f (IpeSymbol b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (NumType (Point 2 a) -> f (NumType (Point 2 b)))
-> Point 2 a -> f (Point 2 b)
coordinates' a -> f b
NumType (Point 2 a) -> f (NumType (Point 2 b))
f Point 2 a
p

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' (f :: * -> *).
Functor f =>
(Point 2 r -> f (Point 2 r')) -> IpeSymbol r -> f (IpeSymbol 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 :: Type) (l :: AttributeUniverse) :: Type 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 StrokeOpacity = IpeOpacity
  AttrMap r Opacity       = IpeOpacity
  AttrMap r Tiling        = IpeTiling
  AttrMap r Gradient      = IpeGradient

  AttrMap r Width          = TextSizeUnit r
  AttrMap r Height         = TextSizeUnit r
  AttrMap r Depth          = TextSizeUnit r
  AttrMap r VAlign         = VerticalAlignment
  AttrMap r HAlign         = HorizontalAlignment
  AttrMap r Style          = TeXStyle

  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 :: forall (h :: * -> *) r s.
Applicative h =>
(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 :: forall (h :: * -> *) r s.
Applicative h =>
(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 (ATraversal (Matrix 3 3 r) (Matrix 3 3 s) r s
-> Traversal (Matrix 3 3 r) (Matrix 3 3 s) r s
forall s t a b. ATraversal s t a b -> Traversal s t a b
cloneTraversal ATraversal (Matrix 3 3 r) (Matrix 3 3 s) r s
(NumType (Matrix 3 3 r)
 -> Bazaar (->) r s (NumType (Matrix 3 3 s)))
-> Matrix 3 3 r -> Bazaar (->) r s (Matrix 3 3 s)
forall matrix matrix'.
HasElements matrix matrix' =>
IndexedTraversal1
  (Int, Int) matrix matrix' (NumType matrix) (NumType matrix')
IndexedTraversal1
  (Int, Int)
  (Matrix 3 3 r)
  (Matrix 3 3 s)
  (NumType (Matrix 3 3 r))
  (NumType (Matrix 3 3 s))
elements r -> h s
f)
instance TraverseIpeAttr Pin             where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(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 :: forall (h :: * -> *) r s.
Applicative h =>
(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 :: forall (h :: * -> *) r s.
Applicative h =>
(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)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> IpeColor a -> f (IpeColor b)
traverse r -> h s
f)
instance TraverseIpeAttr Fill         where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(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)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> IpeColor a -> f (IpeColor b)
traverse r -> h s
f)
instance TraverseIpeAttr Pen          where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(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)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> IpePen a -> f (IpePen b)
traverse r -> h s
f)
instance TraverseIpeAttr Size         where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(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)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> IpeSize a -> f (IpeSize b)
traverse r -> h s
f)

-- -- PathAttributeUniverse
instance TraverseIpeAttr Dash       where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(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)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> IpeDash a -> f (IpeDash b)
traverse r -> h s
f)
instance TraverseIpeAttr LineCap    where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(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 :: forall (h :: * -> *) r s.
Applicative h =>
(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 :: forall (h :: * -> *) r s.
Applicative h =>
(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 :: forall (h :: * -> *) r s.
Applicative h =>
(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)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> IpeArrow a -> f (IpeArrow b)
traverse r -> h s
f)
instance TraverseIpeAttr RArrow     where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(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)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> IpeArrow a -> f (IpeArrow b)
traverse r -> h s
f)
instance TraverseIpeAttr StrokeOpacity  where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(r -> h s)
-> Attr (AttrMapSym1 r) 'StrokeOpacity
-> h (Attr (AttrMapSym1 s) 'StrokeOpacity)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'StrokeOpacity
-> h (Attr (AttrMapSym1 s) 'StrokeOpacity)
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 Opacity    where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(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 :: forall (h :: * -> *) r s.
Applicative h =>
(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 :: forall (h :: * -> *) r s.
Applicative h =>
(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

-- TextAttibuteUniverse
instance TraverseIpeAttr Width   where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(r -> h s)
-> Attr (AttrMapSym1 r) 'Width -> h (Attr (AttrMapSym1 s) 'Width)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Width -> h (Apply (AttrMapSym1 s) 'Width))
-> Attr (AttrMapSym1 r) 'Width -> h (Attr (AttrMapSym1 s) 'Width)
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) -> TextSizeUnit r -> h (TextSizeUnit s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TextSizeUnit a -> f (TextSizeUnit b)
traverse r -> h s
f)
instance TraverseIpeAttr Height  where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(r -> h s)
-> Attr (AttrMapSym1 r) 'Height -> h (Attr (AttrMapSym1 s) 'Height)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Height
 -> h (Apply (AttrMapSym1 s) 'Height))
-> Attr (AttrMapSym1 r) 'Height -> h (Attr (AttrMapSym1 s) 'Height)
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) -> TextSizeUnit r -> h (TextSizeUnit s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TextSizeUnit a -> f (TextSizeUnit b)
traverse r -> h s
f)
instance TraverseIpeAttr Depth   where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(r -> h s)
-> Attr (AttrMapSym1 r) 'Depth -> h (Attr (AttrMapSym1 s) 'Depth)
traverseIpeAttr r -> h s
f = (Apply (AttrMapSym1 r) 'Depth -> h (Apply (AttrMapSym1 s) 'Depth))
-> Attr (AttrMapSym1 r) 'Depth -> h (Attr (AttrMapSym1 s) 'Depth)
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) -> TextSizeUnit r -> h (TextSizeUnit s)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TextSizeUnit a -> f (TextSizeUnit b)
traverse r -> h s
f)
instance TraverseIpeAttr VAlign  where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(r -> h s)
-> Attr (AttrMapSym1 r) 'VAlign -> h (Attr (AttrMapSym1 s) 'VAlign)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'VAlign -> h (Attr (AttrMapSym1 s) 'VAlign)
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 HAlign  where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(r -> h s)
-> Attr (AttrMapSym1 r) 'HAlign -> h (Attr (AttrMapSym1 s) 'HAlign)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'HAlign -> h (Attr (AttrMapSym1 s) 'HAlign)
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 Style   where traverseIpeAttr :: forall (h :: * -> *) r s.
Applicative h =>
(r -> h s)
-> Attr (AttrMapSym1 r) 'Style -> h (Attr (AttrMapSym1 s) 'Style)
traverseIpeAttr r -> h s
_ = Attr (AttrMapSym1 r) 'Style -> h (Attr (AttrMapSym1 s) 'Style)
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 :: forall (h :: * -> *) r s.
Applicative h =>
(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)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Path a -> f (Path 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 :: Type) (s :: GroupAttributeUniverse) :: Type 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
$cshowsPrec :: forall r. Show r => Int -> Group r -> ShowS
showsPrec :: Int -> Group r -> ShowS
$cshow :: forall r. Show r => Group r -> String
show :: Group r -> String
$cshowList :: forall r. Show r => [Group r] -> ShowS
showList :: [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
$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
/= :: Group r -> Group r -> Bool
Eq,(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
$cfmap :: forall a b. (a -> b) -> Group a -> Group b
fmap :: forall a b. (a -> b) -> Group a -> Group b
$c<$ :: forall a b. a -> Group b -> Group a
<$ :: forall a b. a -> Group b -> Group a
Functor,(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
$cfold :: forall m. Monoid m => Group m -> m
fold :: forall m. Monoid m => Group m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Group a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Group a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Group a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> Group a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> Group a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Group a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Group a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Group a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Group a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Group a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Group a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> Group a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> Group a -> a
foldr1 :: forall a. (a -> a -> a) -> Group a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Group a -> a
foldl1 :: forall a. (a -> a -> a) -> Group a -> a
$ctoList :: forall a. Group a -> [a]
toList :: forall a. Group a -> [a]
$cnull :: forall a. Group a -> Bool
null :: forall a. Group a -> Bool
$clength :: forall a. Group a -> Int
length :: forall a. Group a -> Int
$celem :: forall a. Eq a => a -> Group a -> Bool
elem :: forall a. Eq a => a -> Group a -> Bool
$cmaximum :: forall a. Ord a => Group a -> a
maximum :: forall a. Ord a => Group a -> a
$cminimum :: forall a. Ord a => Group a -> a
minimum :: forall a. Ord a => Group a -> a
$csum :: forall a. Num a => Group a -> a
sum :: forall a. Num a => Group a -> a
$cproduct :: forall a. Num a => Group a -> a
product :: forall a. Num a => Group a -> a
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
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)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Group a -> f (Group b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Group a -> f (Group b)
$csequenceA :: forall (f :: * -> *) a. Applicative f => Group (f a) -> f (Group a)
sequenceA :: forall (f :: * -> *) a. Applicative f => Group (f a) -> f (Group a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Group a -> m (Group b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Group a -> m (Group b)
$csequence :: forall (m :: * -> *) a. Monad m => Group (m a) -> m (Group a)
sequence :: forall (m :: * -> *) a. Monad m => Group (m a) -> m (Group a)
Traversable,(forall x. Group r -> Rep (Group r) x)
-> (forall x. Rep (Group r) x -> Group r) -> Generic (Group r)
forall x. Rep (Group r) x -> Group r
forall x. Group r -> Rep (Group r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (Group r) x -> Group r
forall r x. Group r -> Rep (Group r) x
$cfrom :: forall r x. Group r -> Rep (Group r) x
from :: forall x. Group r -> Rep (Group r) x
$cto :: forall r x. Rep (Group r) x -> Group r
to :: forall x. Rep (Group r) x -> Group r
Generic)

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

instance (Fractional r, Eq 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])
    -> IpeObject' Group r)
-> IpeObject' Group r
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' (f :: * -> *).
Functor f =>
(core -> f core') -> (core :+ extra) -> f (core' :+ extra)
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) ImageAttributes
IpeObject' Image r
i(Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
-> ((Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
    -> IpeObject' Image r)
-> IpeObject' Image r
forall a b. a -> (a -> b) -> b
&(Image r -> Identity (Image r))
-> (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
-> Identity (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
forall core extra core' (f :: * -> *).
Functor f =>
(core -> f core') -> (core :+ extra) -> f (core' :+ extra)
core ((Image r -> Identity (Image r))
 -> (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
 -> Identity
      (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes))
-> (Image r -> Image r)
-> (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
-> Image r :+ Attributes (AttrMapSym1 r) ImageAttributes
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)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
        'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]
IpeObject' TextLabel r
i(TextLabel r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
         'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> ((TextLabel r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
             'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
    -> IpeObject' TextLabel r)
-> IpeObject' TextLabel r
forall a b. a -> (a -> b) -> b
&(TextLabel r -> Identity (TextLabel r))
-> (TextLabel r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
            'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> Identity
     (TextLabel r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
              'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
forall core extra core' (f :: * -> *).
Functor f =>
(core -> f core') -> (core :+ extra) -> f (core' :+ extra)
core ((TextLabel r -> Identity (TextLabel r))
 -> (TextLabel r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
             'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
 -> Identity
      (TextLabel r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
               'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]))
-> (TextLabel r -> TextLabel r)
-> (TextLabel r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
            'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> TextLabel r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
           'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]
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)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
        'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]
IpeObject' MiniPage r
i(MiniPage r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
         'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> ((MiniPage r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
             'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
    -> IpeObject' MiniPage r)
-> IpeObject' MiniPage r
forall a b. a -> (a -> b) -> b
&(MiniPage r -> Identity (MiniPage r))
-> (MiniPage r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
            'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> Identity
     (MiniPage r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
              'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
forall core extra core' (f :: * -> *).
Functor f =>
(core -> f core') -> (core :+ extra) -> f (core' :+ extra)
core ((MiniPage r -> Identity (MiniPage r))
 -> (MiniPage r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
             'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
 -> Identity
      (MiniPage r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
               'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]))
-> (MiniPage r -> MiniPage r)
-> (MiniPage r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
            'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> MiniPage r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
           'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]
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])
    -> IpeObject' IpeSymbol r)
-> IpeObject' IpeSymbol r
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' (f :: * -> *).
Functor f =>
(core -> f core') -> (core :+ extra) -> f (core' :+ extra)
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,
        'StrokeOpacity, '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,
         'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
-> ((Path r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
             'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
             'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
    -> IpeObject' Path r)
-> IpeObject' Path r
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,
            'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
-> Identity
     (Path r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
              'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
              'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
forall core extra core' (f :: * -> *).
Functor f =>
(core -> f core') -> (core :+ extra) -> f (core' :+ extra)
core ((Path r -> Identity (Path r))
 -> (Path r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
             'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
             'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
 -> Identity
      (Path r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
               'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
               'StrokeOpacity, '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,
            'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
-> Path r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
           'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
           'StrokeOpacity, '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

instance (Fractional r, Eq 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 a b. (a -> b) -> [a] -> [b]
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 :: Type -> Type) :: [AttributeUniverse] where
  AttributesOf Group     = GroupAttributes
  AttributesOf Image     = ImageAttributes
  AttributesOf TextLabel = TextLabelAttributes
  AttributesOf MiniPage  = MiniPageAttributes
  AttributesOf IpeSymbol = SymbolAttributes
  AttributesOf Path      = PathAttributes


-- | Attributes' :: Type -> [AttributeUniverse] -> Type
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 :: forall (g :: * -> *) r (f :: * -> *).
Functor f =>
(IpeAttributes g r -> f (IpeAttributes g r))
-> IpeObject' g r -> f (IpeObject' g r)
attributes = (Attributes' r (AttributesOf g)
 -> f (Attributes' r (AttributesOf g)))
-> (g r :+ Attributes' r (AttributesOf g))
-> f (g r :+ Attributes' r (AttributesOf g))
forall core extra extra' (f :: * -> *).
Functor f =>
(extra -> f extra') -> (core :+ extra) -> f (core :+ extra')
extra

-- | Map some function over the coordinates of the ipe Attributes
mapIpeAttrs      :: AllConstrained TraverseIpeAttr (AttributesOf g)
                 => proxy g -> (r -> s) -> IpeAttributes g r -> IpeAttributes g s
mapIpeAttrs :: forall (g :: * -> *) (proxy :: (* -> *) -> *) r s.
AllConstrained TraverseIpeAttr (AttributesOf g) =>
proxy g -> (r -> s) -> IpeAttributes g r -> IpeAttributes g s
mapIpeAttrs proxy g
px r -> s
f = Identity (Attributes' s (AttributesOf g))
-> Attributes' s (AttributesOf g)
forall a. Identity a -> a
runIdentity (Identity (Attributes' s (AttributesOf g))
 -> Attributes' s (AttributesOf g))
-> (Attributes' r (AttributesOf g)
    -> Identity (Attributes' s (AttributesOf g)))
-> Attributes' r (AttributesOf g)
-> Attributes' s (AttributesOf g)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. proxy g
-> (r -> Identity s)
-> Attributes' r (AttributesOf g)
-> Identity (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
px (s -> Identity s
forall a. a -> Identity a
Identity (s -> Identity s) -> (r -> s) -> r -> Identity s
forall b c a. (b -> c) -> (a -> b) -> a -> c
. r -> s
f)

-- | Traverse for ipe attributes
traverseIpeAttrs               :: ( Applicative f
                                  , AllConstrained TraverseIpeAttr (AttributesOf g)
                                  ) => proxy g -> (r -> f s) -> IpeAttributes g r -> f (IpeAttributes g s)
traverseIpeAttrs :: 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
_ r -> f s
f (Attrs Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
ats) = (Rec (Attr (AttrMapSym1 s)) (AttributesOf g)
 -> Attributes (AttrMapSym1 s) (AttributesOf g))
-> f (Rec (Attr (AttrMapSym1 s)) (AttributesOf g))
-> f (Attributes (AttrMapSym1 s) (AttributesOf g))
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Rec (Attr (AttrMapSym1 s)) (AttributesOf g)
-> Attributes (AttrMapSym1 s) (AttributesOf g)
forall u (f :: TyFun u (*) -> *) (ats :: [u]).
Rec (Attr f) ats -> Attributes f ats
Attrs (f (Rec (Attr (AttrMapSym1 s)) (AttributesOf g))
 -> f (Attributes (AttrMapSym1 s) (AttributesOf g)))
-> (Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
    -> f (Rec (Attr (AttrMapSym1 s)) (AttributesOf g)))
-> Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
-> f (Attributes (AttrMapSym1 s) (AttributesOf g))
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 (Attributes (AttrMapSym1 s) (AttributesOf g)))
-> Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
-> f (Attributes (AttrMapSym1 s) (AttributesOf g))
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' :: 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 = \case
  Rec (Attr (AttrMapSym1 r)) ats
RNil        -> Rec (Attr (AttrMapSym1 s)) ats
-> f (Rec (Attr (AttrMapSym1 s)) ats)
forall a. a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Rec (Attr (AttrMapSym1 s)) ats
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)) 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)) ats)
-> f (Attr (AttrMapSym1 s) r)
-> f (Rec (Attr (AttrMapSym1 s)) rs
      -> Rec (Attr (AttrMapSym1 s)) ats)
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)
forall (h :: * -> *) r s.
Applicative h =>
(r -> h s) -> Attr (AttrMapSym1 r) r -> h (Attr (AttrMapSym1 s) r)
traverseIpeAttr r -> f s
f Attr (AttrMapSym1 r) r
a f (Rec (Attr (AttrMapSym1 s)) rs -> Rec (Attr (AttrMapSym1 s)) ats)
-> f (Rec (Attr (AttrMapSym1 s)) rs)
-> f (Rec (Attr (AttrMapSym1 s)) ats)
forall a b. f (a -> b) -> f a -> f b
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)
  deriving ((forall x. IpeObject r -> Rep (IpeObject r) x)
-> (forall x. Rep (IpeObject r) x -> IpeObject r)
-> Generic (IpeObject r)
forall x. Rep (IpeObject r) x -> IpeObject r
forall x. IpeObject r -> Rep (IpeObject r) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall r x. Rep (IpeObject r) x -> IpeObject r
forall r x. IpeObject r -> Rep (IpeObject r) x
$cfrom :: forall r x. IpeObject r -> Rep (IpeObject r) x
from :: forall x. IpeObject r -> Rep (IpeObject r) x
$cto :: forall r x. Rep (IpeObject r) x -> IpeObject r
to :: forall x. Rep (IpeObject r) x -> IpeObject r
Generic)

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' :: 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
f (g r
i :+ IpeAttributes g r
ats) = g s
-> Attributes' s (AttributesOf g)
-> g s :+ Attributes' s (AttributesOf g)
forall core extra. core -> extra -> core :+ extra
(:+) (g s
 -> Attributes' s (AttributesOf g)
 -> g s :+ Attributes' s (AttributesOf g))
-> f (g s)
-> f (Attributes' s (AttributesOf g)
      -> g s :+ Attributes' s (AttributesOf g))
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)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> g a -> f (g b)
traverse r -> f s
f g r
i f (Attributes' s (AttributesOf g)
   -> g s :+ Attributes' s (AttributesOf g))
-> f (Attributes' s (AttributesOf g))
-> f (g s :+ Attributes' s (AttributesOf g))
forall a b. f (a -> b) -> f a -> f b
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 (forall {k} (t :: k). Proxy t
forall (t :: * -> *). Proxy t
Proxy @g) r -> f s
f IpeAttributes g r
ats

instance Functor IpeObject where
  fmap :: forall a b. (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 :: forall m a. Monoid m => (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 :: forall (f :: * -> *) a b.
Applicative f =>
(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
IpeObject' Group b -> 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) ImageAttributes)
-> IpeObject b
IpeObject' Image b -> IpeObject b
forall r. IpeObject' Image r -> IpeObject r
IpeImage     ((Image b :+ Attributes (AttrMapSym1 b) ImageAttributes)
 -> IpeObject b)
-> f (Image b :+ Attributes (AttrMapSym1 b) ImageAttributes)
-> 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)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
         'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> IpeObject b
IpeObject' TextLabel b -> IpeObject b
forall r. IpeObject' TextLabel r -> IpeObject r
IpeTextLabel ((TextLabel b
  :+ Attributes
       (AttrMapSym1 b)
       '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
          'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
 -> IpeObject b)
-> f (TextLabel b
      :+ Attributes
           (AttrMapSym1 b)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
              'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> 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)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
         'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> IpeObject b
IpeObject' MiniPage b -> IpeObject b
forall r. IpeObject' MiniPage r -> IpeObject r
IpeMiniPage  ((MiniPage b
  :+ Attributes
       (AttrMapSym1 b)
       '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
          'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
 -> IpeObject b)
-> f (MiniPage b
      :+ Attributes
           (AttrMapSym1 b)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
              'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> 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
IpeObject' IpeSymbol b -> 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,
         'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
-> IpeObject b
IpeObject' Path b -> 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,
          'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
 -> IpeObject b)
-> f (Path b
      :+ Attributes
           (AttrMapSym1 b)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
              'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
              'StrokeOpacity, '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 :: forall r s (f :: * -> *).
Functor f =>
([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 :: forall r. IpeObject' Group r -> IpeObject r
mkIpeObject = IpeObject' Group r -> IpeObject r
forall r. IpeObject' Group r -> IpeObject r
IpeGroup
instance ToObject Image      where mkIpeObject :: forall r. IpeObject' Image r -> IpeObject r
mkIpeObject = IpeObject' Image r -> IpeObject r
forall r. IpeObject' Image r -> IpeObject r
IpeImage
instance ToObject TextLabel  where mkIpeObject :: forall r. IpeObject' TextLabel r -> IpeObject r
mkIpeObject = IpeObject' TextLabel r -> IpeObject r
forall r. IpeObject' TextLabel r -> IpeObject r
IpeTextLabel
instance ToObject MiniPage   where mkIpeObject :: forall r. IpeObject' MiniPage r -> IpeObject r
mkIpeObject = IpeObject' MiniPage r -> IpeObject r
forall r. IpeObject' MiniPage r -> IpeObject r
IpeMiniPage
instance ToObject IpeSymbol  where mkIpeObject :: forall r. IpeObject' IpeSymbol r -> IpeObject r
mkIpeObject = IpeObject' IpeSymbol r -> IpeObject r
forall r. IpeObject' IpeSymbol r -> IpeObject r
IpeUse
instance ToObject Path       where mkIpeObject :: forall r. IpeObject' Path r -> IpeObject r
mkIpeObject = IpeObject' Path r -> IpeObject r
forall r. IpeObject' Path r -> IpeObject r
IpePath


-- | Shorthand for constructing ipeObjects
ipeObject'     :: ToObject i => i r -> IpeAttributes i r -> IpeObject r
ipeObject' :: forall (i :: * -> *) r.
ToObject i =>
i r -> IpeAttributes i r -> IpeObject r
ipeObject' i r
i IpeAttributes i r
a = IpeObject' i r -> IpeObject r
forall r. 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 :: forall r (f :: * -> *).
Functor f =>
(Attributes (AttrMapSym1 r) ImageAttributes
 -> f (Attributes (AttrMapSym1 r) ImageAttributes))
-> IpeObject r -> f (IpeObject r)
commonAttributes = (IpeObject r -> Attributes (AttrMapSym1 r) ImageAttributes)
-> (IpeObject r
    -> Attributes (AttrMapSym1 r) ImageAttributes -> IpeObject r)
-> Lens
     (IpeObject r)
     (IpeObject r)
     (Attributes (AttrMapSym1 r) ImageAttributes)
     (Attributes (AttrMapSym1 r) ImageAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens (Rec (Attr (AttrMapSym1 r)) ImageAttributes
-> Attributes (AttrMapSym1 r) ImageAttributes
forall u (f :: TyFun u (*) -> *) (ats :: [u]).
Rec (Attr f) ats -> Attributes f ats
Attrs (Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Attributes (AttrMapSym1 r) ImageAttributes)
-> (IpeObject r -> Rec (Attr (AttrMapSym1 r)) ImageAttributes)
-> IpeObject r
-> Attributes (AttrMapSym1 r) ImageAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IpeObject r -> Rec (Attr (AttrMapSym1 r)) ImageAttributes
forall {r}.
IpeObject r -> Rec (Attr (AttrMapSym1 r)) ImageAttributes
g) (\IpeObject r
x (Attrs Rec (Attr (AttrMapSym1 r)) ImageAttributes
a) -> IpeObject r
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes -> IpeObject r
forall {r}.
IpeObject r
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes -> IpeObject r
s IpeObject r
x Rec (Attr (AttrMapSym1 r)) ImageAttributes
a)
  where
    select :: (CommonAttributes  AttributesOf g) =>
              Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) CommonAttributes)
    select :: forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select = (Attributes' r (AttributesOf g)
 -> f (Attributes' r (AttributesOf g)))
-> (g r :+ Attributes' r (AttributesOf g))
-> f (g r :+ Attributes' r (AttributesOf g))
forall (g :: * -> *) r (f :: * -> *).
Functor f =>
(IpeAttributes g r -> f (IpeAttributes g r))
-> IpeObject' g r -> f (IpeObject' g r)
attributes((Attributes' r (AttributesOf g)
  -> f (Attributes' r (AttributesOf g)))
 -> (g r :+ Attributes' r (AttributesOf g))
 -> f (g r :+ Attributes' r (AttributesOf g)))
-> ((Rec (Attr (AttrMapSym1 r)) ImageAttributes
     -> f (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
    -> Attributes' r (AttributesOf g)
    -> f (Attributes' r (AttributesOf g)))
-> (Rec (Attr (AttrMapSym1 r)) ImageAttributes
    -> f (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> (g r :+ Attributes' r (AttributesOf g))
-> f (g r :+ Attributes' r (AttributesOf g))
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
 -> f (Rec (Attr (AttrMapSym1 r)) (AttributesOf g)))
-> Attributes' r (AttributesOf g)
-> f (Attributes' r (AttributesOf g))
forall {u1} {u2} (f1 :: TyFun u1 (*) -> *) (ats :: [u1])
       (f' :: TyFun u2 (*) -> *) (ats' :: [u2]) (f2 :: * -> *).
Functor f2 =>
(Rec (Attr f1) ats -> f2 (Rec (Attr f') ats'))
-> Attributes f1 ats -> f2 (Attributes f' ats')
unAttrs((Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
  -> f (Rec (Attr (AttrMapSym1 r)) (AttributesOf g)))
 -> Attributes' r (AttributesOf g)
 -> f (Attributes' r (AttributesOf g)))
-> ((Rec (Attr (AttrMapSym1 r)) ImageAttributes
     -> f (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
    -> Rec (Attr (AttrMapSym1 r)) (AttributesOf g)
    -> f (Rec (Attr (AttrMapSym1 r)) (AttributesOf g)))
-> (Rec (Attr (AttrMapSym1 r)) ImageAttributes
    -> f (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> Attributes' r (AttributesOf g)
-> f (Attributes' r (AttributesOf g))
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> f (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> 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)) ImageAttributes
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)) ImageAttributes)
     (Group r
      :+ Attributes
           (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
  (Group r
   :+ Attributes
        (AttrMapSym1 r) '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Clip])
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Const
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' Group r
-> Const
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes) (IpeObject' Group r)
Lens'
  (IpeObject' Group r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select
    g (IpeImage IpeObject' Image r
i)     = Image r :+ Attributes (AttrMapSym1 r) ImageAttributes
IpeObject' Image r
i(Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
-> Getting
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
     (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
  (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Const
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' Image r
-> Const
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes) (IpeObject' Image r)
Lens'
  (IpeObject' Image r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select
    g (IpeTextLabel IpeObject' TextLabel r
i) = TextLabel r
:+ Attributes
     (AttrMapSym1 r)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
        'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]
IpeObject' TextLabel r
i(TextLabel r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
         'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> Getting
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
     (TextLabel r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
              'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
  (TextLabel r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
           'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Const
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' TextLabel r
-> Const
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
     (IpeObject' TextLabel r)
Lens'
  (IpeObject' TextLabel r)
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select
    g (IpeMiniPage IpeObject' MiniPage r
i)  = MiniPage r
:+ Attributes
     (AttrMapSym1 r)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
        'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]
IpeObject' MiniPage r
i(MiniPage r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
         'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> Getting
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
     (MiniPage r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
              'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
  (MiniPage r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
           'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Const
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' MiniPage r
-> Const
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
     (IpeObject' MiniPage r)
Lens'
  (IpeObject' MiniPage r)
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
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)) ImageAttributes)
     (IpeSymbol r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
              'Size])
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
  (IpeSymbol r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Pen,
           'Size])
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Const
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' IpeSymbol r
-> Const
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
     (IpeObject' IpeSymbol r)
Lens'
  (IpeObject' IpeSymbol r)
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
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,
        'StrokeOpacity, '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,
         'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
-> Getting
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
     (Path r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
              'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
              'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes
forall s a. s -> Getting a s a -> a
^.Getting
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
  (Path r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
           'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
           'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Const
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
      (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' Path r
-> Const
     (Rec (Attr (AttrMapSym1 r)) ImageAttributes) (IpeObject' Path r)
Lens'
  (IpeObject' Path r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select

    s :: IpeObject r
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes -> IpeObject r
s (IpeGroup IpeObject' Group r
i)     Rec (Attr (AttrMapSym1 r)) ImageAttributes
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])
    -> IpeObject' Group r)
-> IpeObject' Group r
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> (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)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' Group r -> Identity (IpeObject' Group r)
Lens'
  (IpeObject' Group r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select ((Rec (Attr (AttrMapSym1 r)) ImageAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
 -> (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)) ImageAttributes
-> (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)) ImageAttributes
a
    s (IpeImage IpeObject' Image r
i)     Rec (Attr (AttrMapSym1 r)) ImageAttributes
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) ImageAttributes
IpeObject' Image r
i(Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
-> ((Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
    -> IpeObject' Image r)
-> IpeObject' Image r
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
-> Identity (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' Image r -> Identity (IpeObject' Image r)
Lens'
  (IpeObject' Image r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select ((Rec (Attr (AttrMapSym1 r)) ImageAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
 -> (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
 -> Identity
      (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes))
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes
-> (Image r :+ Attributes (AttrMapSym1 r) ImageAttributes)
-> Image r :+ Attributes (AttrMapSym1 r) ImageAttributes
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rec (Attr (AttrMapSym1 r)) ImageAttributes
a
    s (IpeTextLabel IpeObject' TextLabel r
i) Rec (Attr (AttrMapSym1 r)) ImageAttributes
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)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
        'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]
IpeObject' TextLabel r
i(TextLabel r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
         'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> ((TextLabel r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
             'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
    -> IpeObject' TextLabel r)
-> IpeObject' TextLabel r
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> (TextLabel r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
            'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> Identity
     (TextLabel r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
              'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' TextLabel r -> Identity (IpeObject' TextLabel r)
Lens'
  (IpeObject' TextLabel r)
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select ((Rec (Attr (AttrMapSym1 r)) ImageAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
 -> (TextLabel r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
             'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
 -> Identity
      (TextLabel r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
               'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]))
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes
-> (TextLabel r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
            'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> TextLabel r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
           'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rec (Attr (AttrMapSym1 r)) ImageAttributes
a
    s (IpeMiniPage IpeObject' MiniPage r
i)  Rec (Attr (AttrMapSym1 r)) ImageAttributes
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)
     '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
        'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]
IpeObject' MiniPage r
i(MiniPage r
 :+ Attributes
      (AttrMapSym1 r)
      '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
         'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> ((MiniPage r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
             'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
    -> IpeObject' MiniPage r)
-> IpeObject' MiniPage r
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> (MiniPage r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
            'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> Identity
     (MiniPage r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
              'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' MiniPage r -> Identity (IpeObject' MiniPage r)
Lens'
  (IpeObject' MiniPage r)
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select ((Rec (Attr (AttrMapSym1 r)) ImageAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
 -> (MiniPage r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
             'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
 -> Identity
      (MiniPage r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
               'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]))
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes
-> (MiniPage r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
            'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity])
-> MiniPage r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Size, 'Width,
           'Height, 'Depth, 'VAlign, 'HAlign, 'Style, 'Opacity]
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rec (Attr (AttrMapSym1 r)) ImageAttributes
a
    s (IpeUse IpeObject' IpeSymbol r
i)       Rec (Attr (AttrMapSym1 r)) ImageAttributes
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])
    -> IpeObject' IpeSymbol r)
-> IpeObject' IpeSymbol r
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> (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)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' IpeSymbol r -> Identity (IpeObject' IpeSymbol r)
Lens'
  (IpeObject' IpeSymbol r)
  (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select ((Rec (Attr (AttrMapSym1 r)) ImageAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
 -> (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)) ImageAttributes
-> (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)) ImageAttributes
a
    s (IpePath IpeObject' Path r
i)      Rec (Attr (AttrMapSym1 r)) ImageAttributes
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,
        'StrokeOpacity, '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,
         'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
-> ((Path r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
             'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
             'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
    -> IpeObject' Path r)
-> IpeObject' Path r
forall a b. a -> (a -> b) -> b
&(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> (Path r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
            'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
            'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
-> Identity
     (Path r
      :+ Attributes
           (AttrMapSym1 r)
           '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
              'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
              'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
(Rec (Attr (AttrMapSym1 r)) ImageAttributes
 -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
-> IpeObject' Path r -> Identity (IpeObject' Path r)
Lens'
  (IpeObject' Path r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
forall (g :: * -> *) r.
(ImageAttributes ⊆ AttributesOf g) =>
Lens' (IpeObject' g r) (Rec (Attr (AttrMapSym1 r)) ImageAttributes)
select ((Rec (Attr (AttrMapSym1 r)) ImageAttributes
  -> Identity (Rec (Attr (AttrMapSym1 r)) ImageAttributes))
 -> (Path r
     :+ Attributes
          (AttrMapSym1 r)
          '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
             'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
             'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
 -> Identity
      (Path r
       :+ Attributes
            (AttrMapSym1 r)
            '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
               'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
               'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient]))
-> Rec (Attr (AttrMapSym1 r)) ImageAttributes
-> (Path r
    :+ Attributes
         (AttrMapSym1 r)
         '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
            'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
            'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient])
-> Path r
   :+ Attributes
        (AttrMapSym1 r)
        '[ 'Layer, 'Matrix, 'Pin, 'Transformations, 'Stroke, 'Fill, 'Dash,
           'Pen, 'LineCap, 'LineJoin, 'FillRule, 'Arrow, 'RArrow,
           'StrokeOpacity, 'Opacity, 'Tiling, 'Gradient]
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Rec (Attr (AttrMapSym1 r)) ImageAttributes
a

-- | collect all non-group objects
flattenGroups :: [IpeObject r] -> [IpeObject r]
flattenGroups :: forall r. [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' :: forall r. 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]