module SVG.PathExample 
( pathExample 
) where

import qualified Waterfall.SVG
import qualified Waterfall.Solids as Solids
import qualified Waterfall.TwoD.Shape as Shape
import Data.Bifunctor (Bifunctor(bimap))

pathExample :: String -> Either String Solids.Solid
pathExample :: String -> Either String Solid
pathExample String
pathStr =
    let solidify :: [Path2D] -> Solid
solidify = [Solid] -> Solid
forall a. Monoid a => [a] -> a
mconcat ([Solid] -> Solid) -> ([Path2D] -> [Solid]) -> [Path2D] -> Solid
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Path2D -> Solid) -> [Path2D] -> [Solid]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Double -> Shape -> Solid
Solids.prism Double
1 (Shape -> Solid) -> (Path2D -> Shape) -> Path2D -> Solid
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Path2D -> Shape
Shape.makeShape)
    in (SVGError -> String)
-> ([Path2D] -> Solid)
-> Either SVGError [Path2D]
-> Either String Solid
forall a b c d. (a -> b) -> (c -> d) -> Either a c -> Either b d
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap SVGError -> String
forall a. Show a => a -> String
show [Path2D] -> Solid
solidify (Either SVGError [Path2D] -> Either String Solid)
-> Either SVGError [Path2D] -> Either String Solid
forall a b. (a -> b) -> a -> b
$ String -> Either SVGError [Path2D]
Waterfall.SVG.parsePath String
pathStr