{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE TemplateHaskell #-} module Data.Aviation.WB.Arm.Arm( Arm(..) , staticArm , rangeArm , HasArm(..) , HasArms(..) , SetArm(..) , HasArm0(..) ) where import Control.Category((.)) import Control.Lens(Lens', Traversal', Setter', lens, makeClassy) import Data.Aviation.WB.Arm.ArmRangeLower(HasArmRangeLowers(armRangeLowers), SetArmRangeLower(setArmRangeLower)) import Data.Aviation.WB.Arm.ArmRange(ArmRange, HasArmRanges(armRanges), SetArmRange(setArmRange), HasArmRange0(armRange0)) import Data.Aviation.WB.Arm.ArmStatic(ArmStatic, HasArmStatic(armStatic), HasArmStatics(armStatics), SetArmStatic(setArmStatic)) import Data.Aviation.WB.Arm.ArmRangeUpper(HasArmRangeUppers(armRangeUppers), SetArmRangeUpper(setArmRangeUpper)) import Data.Functor((<$>)) import Data.Traversable(traverse) import Data.Eq(Eq) import Data.Maybe(Maybe(Nothing, Just)) import Data.Ord(Ord) import Prelude(Show) data Arm = Arm ArmStatic (Maybe ArmRange) deriving (Arm -> Arm -> Bool (Arm -> Arm -> Bool) -> (Arm -> Arm -> Bool) -> Eq Arm forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Arm -> Arm -> Bool $c/= :: Arm -> Arm -> Bool == :: Arm -> Arm -> Bool $c== :: Arm -> Arm -> Bool Eq, Eq Arm Eq Arm -> (Arm -> Arm -> Ordering) -> (Arm -> Arm -> Bool) -> (Arm -> Arm -> Bool) -> (Arm -> Arm -> Bool) -> (Arm -> Arm -> Bool) -> (Arm -> Arm -> Arm) -> (Arm -> Arm -> Arm) -> Ord Arm Arm -> Arm -> Bool Arm -> Arm -> Ordering Arm -> Arm -> Arm 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 min :: Arm -> Arm -> Arm $cmin :: Arm -> Arm -> Arm max :: Arm -> Arm -> Arm $cmax :: Arm -> Arm -> Arm >= :: Arm -> Arm -> Bool $c>= :: Arm -> Arm -> Bool > :: Arm -> Arm -> Bool $c> :: Arm -> Arm -> Bool <= :: Arm -> Arm -> Bool $c<= :: Arm -> Arm -> Bool < :: Arm -> Arm -> Bool $c< :: Arm -> Arm -> Bool compare :: Arm -> Arm -> Ordering $ccompare :: Arm -> Arm -> Ordering $cp1Ord :: Eq Arm Ord, Int -> Arm -> ShowS [Arm] -> ShowS Arm -> String (Int -> Arm -> ShowS) -> (Arm -> String) -> ([Arm] -> ShowS) -> Show Arm forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Arm] -> ShowS $cshowList :: [Arm] -> ShowS show :: Arm -> String $cshow :: Arm -> String showsPrec :: Int -> Arm -> ShowS $cshowsPrec :: Int -> Arm -> ShowS Show) makeClassy ''Arm staticArm :: ArmStatic -> Arm staticArm :: ArmStatic -> Arm staticArm ArmStatic x = ArmStatic -> Maybe ArmRange -> Arm Arm ArmStatic x Maybe ArmRange forall a. Maybe a Nothing rangeArm :: ArmStatic -> ArmRange -> Arm rangeArm :: ArmStatic -> ArmRange -> Arm rangeArm ArmStatic x = ArmStatic -> Maybe ArmRange -> Arm Arm ArmStatic x (Maybe ArmRange -> Arm) -> (ArmRange -> Maybe ArmRange) -> ArmRange -> Arm forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . ArmRange -> Maybe ArmRange forall a. a -> Maybe a Just class HasArms a where arms :: Traversal' a Arm instance HasArms Arm where arms :: (Arm -> f Arm) -> Arm -> f Arm arms = (Arm -> f Arm) -> Arm -> f Arm forall c. HasArm c => Lens' c Arm arm class SetArm a where setArm :: Setter' a Arm instance SetArm Arm where setArm :: (Arm -> f Arm) -> Arm -> f Arm setArm = (Arm -> f Arm) -> Arm -> f Arm forall c. HasArm c => Lens' c Arm arm instance HasArmStatic Arm where armStatic :: (ArmStatic -> f ArmStatic) -> Arm -> f Arm armStatic = (Arm -> ArmStatic) -> (Arm -> ArmStatic -> Arm) -> Lens' Arm ArmStatic forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b lens (\(Arm ArmStatic s Maybe ArmRange _) -> ArmStatic s) (\(Arm ArmStatic _ Maybe ArmRange r) ArmStatic s -> ArmStatic -> Maybe ArmRange -> Arm Arm ArmStatic s Maybe ArmRange r) instance HasArmStatics Arm where armStatics :: (ArmStatic -> f ArmStatic) -> Arm -> f Arm armStatics = (ArmStatic -> f ArmStatic) -> Arm -> f Arm forall c. HasArmStatic c => Lens' c ArmStatic armStatic instance HasArmRanges Arm where armRanges :: (ArmRange -> f ArmRange) -> Arm -> f Arm armRanges ArmRange -> f ArmRange f (Arm ArmStatic s Maybe ArmRange r) = ArmStatic -> Maybe ArmRange -> Arm Arm ArmStatic s (Maybe ArmRange -> Arm) -> f (Maybe ArmRange) -> f Arm forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> (ArmRange -> f ArmRange) -> Maybe ArmRange -> f (Maybe ArmRange) forall (t :: * -> *) (f :: * -> *) a b. (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) traverse ArmRange -> f ArmRange f Maybe ArmRange r instance SetArmRange Arm where setArmRange :: (ArmRange -> f ArmRange) -> Arm -> f Arm setArmRange = (ArmRange -> f ArmRange) -> Arm -> f Arm forall a. HasArmRanges a => Traversal' a ArmRange armRanges instance SetArmStatic Arm where setArmStatic :: (ArmStatic -> f ArmStatic) -> Arm -> f Arm setArmStatic = (ArmStatic -> f ArmStatic) -> Arm -> f Arm forall c. HasArmStatic c => Lens' c ArmStatic armStatic ((ArmStatic -> f ArmStatic) -> Arm -> f Arm) -> ((ArmStatic -> f ArmStatic) -> ArmStatic -> f ArmStatic) -> (ArmStatic -> f ArmStatic) -> Arm -> f Arm forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . (ArmStatic -> f ArmStatic) -> ArmStatic -> f ArmStatic forall a. SetArmStatic a => Setter' a ArmStatic setArmStatic instance HasArmRangeLowers Arm where armRangeLowers :: (ArmRangeLower -> f ArmRangeLower) -> Arm -> f Arm armRangeLowers = (ArmRange -> f ArmRange) -> Arm -> f Arm forall a. HasArmRanges a => Traversal' a ArmRange armRanges ((ArmRange -> f ArmRange) -> Arm -> f Arm) -> ((ArmRangeLower -> f ArmRangeLower) -> ArmRange -> f ArmRange) -> (ArmRangeLower -> f ArmRangeLower) -> Arm -> f Arm forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . (ArmRangeLower -> f ArmRangeLower) -> ArmRange -> f ArmRange forall a. HasArmRangeLowers a => Traversal' a ArmRangeLower armRangeLowers instance HasArmRangeUppers Arm where armRangeUppers :: (ArmRangeUpper -> f ArmRangeUpper) -> Arm -> f Arm armRangeUppers = (ArmRange -> f ArmRange) -> Arm -> f Arm forall a. HasArmRanges a => Traversal' a ArmRange armRanges ((ArmRange -> f ArmRange) -> Arm -> f Arm) -> ((ArmRangeUpper -> f ArmRangeUpper) -> ArmRange -> f ArmRange) -> (ArmRangeUpper -> f ArmRangeUpper) -> Arm -> f Arm forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . (ArmRangeUpper -> f ArmRangeUpper) -> ArmRange -> f ArmRange forall a. HasArmRangeUppers a => Traversal' a ArmRangeUpper armRangeUppers instance SetArmRangeLower Arm where setArmRangeLower :: (ArmRangeLower -> f ArmRangeLower) -> Arm -> f Arm setArmRangeLower = (ArmRange -> f ArmRange) -> Arm -> f Arm forall a. SetArmRange a => Setter' a ArmRange setArmRange ((ArmRange -> f ArmRange) -> Arm -> f Arm) -> ((ArmRangeLower -> f ArmRangeLower) -> ArmRange -> f ArmRange) -> (ArmRangeLower -> f ArmRangeLower) -> Arm -> f Arm forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . (ArmRangeLower -> f ArmRangeLower) -> ArmRange -> f ArmRange forall a. SetArmRangeLower a => Setter' a ArmRangeLower setArmRangeLower instance SetArmRangeUpper Arm where setArmRangeUpper :: (ArmRangeUpper -> f ArmRangeUpper) -> Arm -> f Arm setArmRangeUpper = (ArmRange -> f ArmRange) -> Arm -> f Arm forall a. SetArmRange a => Setter' a ArmRange setArmRange ((ArmRange -> f ArmRange) -> Arm -> f Arm) -> ((ArmRangeUpper -> f ArmRangeUpper) -> ArmRange -> f ArmRange) -> (ArmRangeUpper -> f ArmRangeUpper) -> Arm -> f Arm forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c . (ArmRangeUpper -> f ArmRangeUpper) -> ArmRange -> f ArmRange forall a. SetArmRangeUpper a => Setter' a ArmRangeUpper setArmRangeUpper class HasArm0 a where arm0 :: Lens' a (Maybe Arm) instance HasArmRange0 Arm where armRange0 :: (Maybe ArmRange -> f (Maybe ArmRange)) -> Arm -> f Arm armRange0 = (Arm -> Maybe ArmRange) -> (Arm -> Maybe ArmRange -> Arm) -> Lens' Arm (Maybe ArmRange) forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b lens (\(Arm ArmStatic _ Maybe ArmRange r) -> Maybe ArmRange r) (\(Arm ArmStatic s Maybe ArmRange _) Maybe ArmRange r -> ArmStatic -> Maybe ArmRange -> Arm Arm ArmStatic s Maybe ArmRange r)