{-# LANGUAGE TemplateHaskell #-}
--------------------------------------------------------------------------------
-- |
-- Module      :  Ipe.Path
-- Copyright   :  (C) Frank Staals
-- License     :  see the LICENSE file
-- Maintainer  :  Frank Staals
--
-- Defines an Ipe Path.
--
--------------------------------------------------------------------------------
module Ipe.Path(
    Path(Path), pathSegments
  , PathSegment(..)

  , _PolyLineSegment
  , _PolygonPath
  , _CubicBezierSegment
  , _QuadraticBezierSegment
  , _EllipseSegment
  , _ArcSegment
  , _SplineSegment
  , _ClosedSplineSegment

  , Operation(..)
  , _MoveTo
  , _LineTo
  , _CurveTo
  , _QCurveTo
  , _Ellipse
  , _ArcTo
  , _Spline
  , _ClosedSpline
  , _ClosePath
  ) where

import           Control.Lens hiding (rmap)
import           Data.Bitraversable
import           Data.Geometry.BezierSpline
import           Data.Geometry.Point
import           Data.Geometry.Ellipse(Ellipse)
import           Data.Geometry.PolyLine
import           Data.Geometry.Polygon (SimplePolygon)
import           Data.Geometry.Properties
import           Data.Geometry.Transformation
import           Data.Geometry.Matrix
import qualified Data.LSeq as LSeq
import           Data.Traversable

--------------------------------------------------------------------------------
-- | Paths

-- | Paths consist of Path Segments. PathSegments come in the following forms:
data PathSegment r = PolyLineSegment        (PolyLine 2 () r)
                   | PolygonPath            (SimplePolygon () r)
                   | CubicBezierSegment     (BezierSpline 3 2 r)
                   | QuadraticBezierSegment (BezierSpline 2 2 r)
                   | EllipseSegment         (Ellipse r)
                     -- TODO
                   | ArcSegment
                   | SplineSegment          -- (Spline 2 r)
                   | ClosedSplineSegment    -- (ClosedSpline 2 r)
                   deriving (Int -> PathSegment r -> ShowS
[PathSegment r] -> ShowS
PathSegment r -> String
(Int -> PathSegment r -> ShowS)
-> (PathSegment r -> String)
-> ([PathSegment r] -> ShowS)
-> Show (PathSegment r)
forall r. Show r => Int -> PathSegment r -> ShowS
forall r. Show r => [PathSegment r] -> ShowS
forall r. Show r => PathSegment r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PathSegment r] -> ShowS
$cshowList :: forall r. Show r => [PathSegment r] -> ShowS
show :: PathSegment r -> String
$cshow :: forall r. Show r => PathSegment r -> String
showsPrec :: Int -> PathSegment r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> PathSegment r -> ShowS
Show,PathSegment r -> PathSegment r -> Bool
(PathSegment r -> PathSegment r -> Bool)
-> (PathSegment r -> PathSegment r -> Bool) -> Eq (PathSegment r)
forall r. Eq r => PathSegment r -> PathSegment r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PathSegment r -> PathSegment r -> Bool
$c/= :: forall r. Eq r => PathSegment r -> PathSegment r -> Bool
== :: PathSegment r -> PathSegment r -> Bool
$c== :: forall r. Eq r => PathSegment r -> PathSegment r -> Bool
Eq)
makePrisms ''PathSegment

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

instance Functor PathSegment where
  fmap :: (a -> b) -> PathSegment a -> PathSegment b
fmap = (a -> b) -> PathSegment a -> PathSegment b
forall (t :: * -> *) a b. Traversable t => (a -> b) -> t a -> t b
fmapDefault
instance Foldable PathSegment where
  foldMap :: (a -> m) -> PathSegment a -> m
foldMap = (a -> m) -> PathSegment a -> m
forall (t :: * -> *) m a.
(Traversable t, Monoid m) =>
(a -> m) -> t a -> m
foldMapDefault
instance Traversable PathSegment where
  traverse :: (a -> f b) -> PathSegment a -> f (PathSegment b)
traverse a -> f b
f = \case
    PolyLineSegment PolyLine 2 () a
p        -> PolyLine 2 () b -> PathSegment b
forall r. PolyLine 2 () r -> PathSegment r
PolyLineSegment (PolyLine 2 () b -> PathSegment b)
-> f (PolyLine 2 () b) -> f (PathSegment b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (() -> f ())
-> (a -> f b) -> PolyLine 2 () a -> f (PolyLine 2 () b)
forall (t :: * -> * -> *) (f :: * -> *) a c b d.
(Bitraversable t, Applicative f) =>
(a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bitraverse () -> f ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure a -> f b
f PolyLine 2 () a
p
    PolygonPath SimplePolygon () a
p            -> SimplePolygon () b -> PathSegment b
forall r. SimplePolygon () r -> PathSegment r
PolygonPath (SimplePolygon () b -> PathSegment b)
-> f (SimplePolygon () b) -> f (PathSegment b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (() -> f ())
-> (a -> f b) -> SimplePolygon () a -> f (SimplePolygon () b)
forall (t :: * -> * -> *) (f :: * -> *) a c b d.
(Bitraversable t, Applicative f) =>
(a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bitraverse () -> f ()
forall (f :: * -> *) a. Applicative f => a -> f a
pure a -> f b
f SimplePolygon () a
p
    CubicBezierSegment BezierSpline 3 2 a
b     -> BezierSpline 3 2 b -> PathSegment b
forall r. BezierSpline 3 2 r -> PathSegment r
CubicBezierSegment (BezierSpline 3 2 b -> PathSegment b)
-> f (BezierSpline 3 2 b) -> f (PathSegment b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f b) -> BezierSpline 3 2 a -> f (BezierSpline 3 2 b)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse a -> f b
f BezierSpline 3 2 a
b
    QuadraticBezierSegment BezierSpline 2 2 a
b -> BezierSpline 2 2 b -> PathSegment b
forall r. BezierSpline 2 2 r -> PathSegment r
QuadraticBezierSegment (BezierSpline 2 2 b -> PathSegment b)
-> f (BezierSpline 2 2 b) -> f (PathSegment b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f b) -> BezierSpline 2 2 a -> f (BezierSpline 2 2 b)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse a -> f b
f BezierSpline 2 2 a
b
    EllipseSegment Ellipse a
e         -> Ellipse b -> PathSegment b
forall r. Ellipse r -> PathSegment r
EllipseSegment (Ellipse b -> PathSegment b) -> f (Ellipse b) -> f (PathSegment b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> f b) -> Ellipse a -> f (Ellipse b)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse a -> f b
f Ellipse a
e
    PathSegment a
ArcSegment               -> PathSegment b -> f (PathSegment b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure PathSegment b
forall r. PathSegment r
ArcSegment
    PathSegment a
SplineSegment            -> PathSegment b -> f (PathSegment b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure PathSegment b
forall r. PathSegment r
SplineSegment
    PathSegment a
ClosedSplineSegment      -> PathSegment b -> f (PathSegment b)
forall (f :: * -> *) a. Applicative f => a -> f a
pure PathSegment b
forall r. PathSegment r
ClosedSplineSegment

instance Fractional r => IsTransformable (PathSegment r) where
  transformBy :: Transformation
  (Dimension (PathSegment r)) (NumType (PathSegment r))
-> PathSegment r -> PathSegment r
transformBy Transformation
  (Dimension (PathSegment r)) (NumType (PathSegment r))
t = \case
    PolyLineSegment PolyLine 2 () r
p        -> PolyLine 2 () r -> PathSegment r
forall r. PolyLine 2 () r -> PathSegment r
PolyLineSegment (PolyLine 2 () r -> PathSegment r)
-> PolyLine 2 () r -> PathSegment r
forall a b. (a -> b) -> a -> b
$ Transformation
  (Dimension (PolyLine 2 () r)) (NumType (PolyLine 2 () r))
-> PolyLine 2 () r -> PolyLine 2 () r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation
  (Dimension (PolyLine 2 () r)) (NumType (PolyLine 2 () r))
Transformation
  (Dimension (PathSegment r)) (NumType (PathSegment r))
t PolyLine 2 () r
p
    PolygonPath SimplePolygon () r
p            -> SimplePolygon () r -> PathSegment r
forall r. SimplePolygon () r -> PathSegment r
PolygonPath (SimplePolygon () r -> PathSegment r)
-> SimplePolygon () r -> PathSegment r
forall a b. (a -> b) -> a -> b
$ Transformation
  (Dimension (SimplePolygon () r)) (NumType (SimplePolygon () r))
-> SimplePolygon () r -> SimplePolygon () r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation
  (Dimension (SimplePolygon () r)) (NumType (SimplePolygon () r))
Transformation
  (Dimension (PathSegment r)) (NumType (PathSegment r))
t SimplePolygon () r
p
    CubicBezierSegment BezierSpline 3 2 r
b     -> BezierSpline 3 2 r -> PathSegment r
forall r. BezierSpline 3 2 r -> PathSegment r
CubicBezierSegment (BezierSpline 3 2 r -> PathSegment r)
-> BezierSpline 3 2 r -> PathSegment r
forall a b. (a -> b) -> a -> b
$ Transformation
  (Dimension (BezierSpline 3 2 r)) (NumType (BezierSpline 3 2 r))
-> BezierSpline 3 2 r -> BezierSpline 3 2 r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation
  (Dimension (BezierSpline 3 2 r)) (NumType (BezierSpline 3 2 r))
Transformation
  (Dimension (PathSegment r)) (NumType (PathSegment r))
t BezierSpline 3 2 r
b
    QuadraticBezierSegment BezierSpline 2 2 r
b -> BezierSpline 2 2 r -> PathSegment r
forall r. BezierSpline 2 2 r -> PathSegment r
QuadraticBezierSegment (BezierSpline 2 2 r -> PathSegment r)
-> BezierSpline 2 2 r -> PathSegment r
forall a b. (a -> b) -> a -> b
$ Transformation
  (Dimension (BezierSpline 2 2 r)) (NumType (BezierSpline 2 2 r))
-> BezierSpline 2 2 r -> BezierSpline 2 2 r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation
  (Dimension (BezierSpline 2 2 r)) (NumType (BezierSpline 2 2 r))
Transformation
  (Dimension (PathSegment r)) (NumType (PathSegment r))
t BezierSpline 2 2 r
b
    EllipseSegment Ellipse r
e         -> Ellipse r -> PathSegment r
forall r. Ellipse r -> PathSegment r
EllipseSegment (Ellipse r -> PathSegment r) -> Ellipse r -> PathSegment r
forall a b. (a -> b) -> a -> b
$ Transformation (Dimension (Ellipse r)) (NumType (Ellipse r))
-> Ellipse r -> Ellipse r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation (Dimension (Ellipse r)) (NumType (Ellipse r))
Transformation
  (Dimension (PathSegment r)) (NumType (PathSegment r))
t Ellipse r
e
    -- TODO:
    PathSegment r
ArcSegment               -> PathSegment r
forall r. PathSegment r
ArcSegment
    PathSegment r
SplineSegment            -> PathSegment r
forall r. PathSegment r
SplineSegment
    PathSegment r
ClosedSplineSegment      -> PathSegment r
forall r. PathSegment r
ClosedSplineSegment


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

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

instance Fractional r => IsTransformable (Path r) where
  transformBy :: Transformation (Dimension (Path r)) (NumType (Path r))
-> Path r -> Path r
transformBy Transformation (Dimension (Path r)) (NumType (Path r))
t (Path LSeq 1 (PathSegment r)
s) = LSeq 1 (PathSegment r) -> Path r
forall r. LSeq 1 (PathSegment r) -> Path r
Path (LSeq 1 (PathSegment r) -> Path r)
-> LSeq 1 (PathSegment r) -> Path r
forall a b. (a -> b) -> a -> b
$ (PathSegment r -> PathSegment r)
-> LSeq 1 (PathSegment r) -> LSeq 1 (PathSegment r)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Transformation
  (Dimension (PathSegment r)) (NumType (PathSegment r))
-> PathSegment r -> PathSegment r
forall g.
IsTransformable g =>
Transformation (Dimension g) (NumType g) -> g -> g
transformBy Transformation
  (Dimension (PathSegment r)) (NumType (PathSegment r))
Transformation (Dimension (Path r)) (NumType (Path r))
t) LSeq 1 (PathSegment r)
s


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

-- | type that represents a path in ipe.
data Operation r = MoveTo (Point 2 r)
                 | LineTo (Point 2 r)
                 | Ellipse (Matrix 3 3 r)
                 | ArcTo (Matrix 3 3 r) (Point 2 r)
                 | Spline [Point 2 r]
                 | ClosedSpline [Point 2 r]
                 | ClosePath
                 -- these should be deprecated
                 | CurveTo (Point 2 r) (Point 2 r) (Point 2 r)
                 | QCurveTo (Point 2 r) (Point 2 r)
                 deriving (Operation r -> Operation r -> Bool
(Operation r -> Operation r -> Bool)
-> (Operation r -> Operation r -> Bool) -> Eq (Operation r)
forall r. Eq r => Operation r -> Operation r -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Operation r -> Operation r -> Bool
$c/= :: forall r. Eq r => Operation r -> Operation r -> Bool
== :: Operation r -> Operation r -> Bool
$c== :: forall r. Eq r => Operation r -> Operation r -> Bool
Eq, Int -> Operation r -> ShowS
[Operation r] -> ShowS
Operation r -> String
(Int -> Operation r -> ShowS)
-> (Operation r -> String)
-> ([Operation r] -> ShowS)
-> Show (Operation r)
forall r. Show r => Int -> Operation r -> ShowS
forall r. Show r => [Operation r] -> ShowS
forall r. Show r => Operation r -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Operation r] -> ShowS
$cshowList :: forall r. Show r => [Operation r] -> ShowS
show :: Operation r -> String
$cshow :: forall r. Show r => Operation r -> String
showsPrec :: Int -> Operation r -> ShowS
$cshowsPrec :: forall r. Show r => Int -> Operation r -> ShowS
Show,a -> Operation b -> Operation a
(a -> b) -> Operation a -> Operation b
(forall a b. (a -> b) -> Operation a -> Operation b)
-> (forall a b. a -> Operation b -> Operation a)
-> Functor Operation
forall a b. a -> Operation b -> Operation a
forall a b. (a -> b) -> Operation a -> Operation b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Operation b -> Operation a
$c<$ :: forall a b. a -> Operation b -> Operation a
fmap :: (a -> b) -> Operation a -> Operation b
$cfmap :: forall a b. (a -> b) -> Operation a -> Operation b
Functor,Operation a -> Bool
(a -> m) -> Operation a -> m
(a -> b -> b) -> b -> Operation a -> b
(forall m. Monoid m => Operation m -> m)
-> (forall m a. Monoid m => (a -> m) -> Operation a -> m)
-> (forall m a. Monoid m => (a -> m) -> Operation a -> m)
-> (forall a b. (a -> b -> b) -> b -> Operation a -> b)
-> (forall a b. (a -> b -> b) -> b -> Operation a -> b)
-> (forall b a. (b -> a -> b) -> b -> Operation a -> b)
-> (forall b a. (b -> a -> b) -> b -> Operation a -> b)
-> (forall a. (a -> a -> a) -> Operation a -> a)
-> (forall a. (a -> a -> a) -> Operation a -> a)
-> (forall a. Operation a -> [a])
-> (forall a. Operation a -> Bool)
-> (forall a. Operation a -> Int)
-> (forall a. Eq a => a -> Operation a -> Bool)
-> (forall a. Ord a => Operation a -> a)
-> (forall a. Ord a => Operation a -> a)
-> (forall a. Num a => Operation a -> a)
-> (forall a. Num a => Operation a -> a)
-> Foldable Operation
forall a. Eq a => a -> Operation a -> Bool
forall a. Num a => Operation a -> a
forall a. Ord a => Operation a -> a
forall m. Monoid m => Operation m -> m
forall a. Operation a -> Bool
forall a. Operation a -> Int
forall a. Operation a -> [a]
forall a. (a -> a -> a) -> Operation a -> a
forall m a. Monoid m => (a -> m) -> Operation a -> m
forall b a. (b -> a -> b) -> b -> Operation a -> b
forall a b. (a -> b -> b) -> b -> Operation a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: Operation a -> a
$cproduct :: forall a. Num a => Operation a -> a
sum :: Operation a -> a
$csum :: forall a. Num a => Operation a -> a
minimum :: Operation a -> a
$cminimum :: forall a. Ord a => Operation a -> a
maximum :: Operation a -> a
$cmaximum :: forall a. Ord a => Operation a -> a
elem :: a -> Operation a -> Bool
$celem :: forall a. Eq a => a -> Operation a -> Bool
length :: Operation a -> Int
$clength :: forall a. Operation a -> Int
null :: Operation a -> Bool
$cnull :: forall a. Operation a -> Bool
toList :: Operation a -> [a]
$ctoList :: forall a. Operation a -> [a]
foldl1 :: (a -> a -> a) -> Operation a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> Operation a -> a
foldr1 :: (a -> a -> a) -> Operation a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> Operation a -> a
foldl' :: (b -> a -> b) -> b -> Operation a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> Operation a -> b
foldl :: (b -> a -> b) -> b -> Operation a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> Operation a -> b
foldr' :: (a -> b -> b) -> b -> Operation a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> Operation a -> b
foldr :: (a -> b -> b) -> b -> Operation a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> Operation a -> b
foldMap' :: (a -> m) -> Operation a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> Operation a -> m
foldMap :: (a -> m) -> Operation a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> Operation a -> m
fold :: Operation m -> m
$cfold :: forall m. Monoid m => Operation m -> m
Foldable,Functor Operation
Foldable Operation
Functor Operation
-> Foldable Operation
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Operation a -> f (Operation b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Operation (f a) -> f (Operation a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Operation a -> m (Operation b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Operation (m a) -> m (Operation a))
-> Traversable Operation
(a -> f b) -> Operation a -> f (Operation b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
Operation (m a) -> m (Operation a)
forall (f :: * -> *) a.
Applicative f =>
Operation (f a) -> f (Operation a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Operation a -> m (Operation b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Operation a -> f (Operation b)
sequence :: Operation (m a) -> m (Operation a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
Operation (m a) -> m (Operation a)
mapM :: (a -> m b) -> Operation a -> m (Operation b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Operation a -> m (Operation b)
sequenceA :: Operation (f a) -> f (Operation a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
Operation (f a) -> f (Operation a)
traverse :: (a -> f b) -> Operation a -> f (Operation b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Operation a -> f (Operation b)
$cp2Traversable :: Foldable Operation
$cp1Traversable :: Functor Operation
Traversable)
makePrisms ''Operation