{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE TemplateHaskell #-}
module Data.Aviation.Casr.Logbook.Reports.FlightTimeReport(
FlightTimeReport(..)
, HasFlightTimeReport(..)
, singleFlightTimeReport
, getFlightTimeReport
) where
import Control.Category((.))
import Control.Lens ( preview, (^.), view, isn't, makeClassy )
import Data.Aviation.Casr.Logbook.Types
import Data.Eq(Eq)
import Data.Foldable(foldl')
import Data.Int(Int)
import qualified Data.Map as Map(unionWith, singleton, empty)
import Data.Map(Map)
import Data.Maybe(Maybe(Just, Nothing))
import Data.Monoid(Monoid(mappend, mempty))
import Data.Ord(Ord)
import Data.Semigroup(Semigroup((<>)))
import Data.String(String)
import Prelude(Show, (+))
data FlightTimeReport =
FlightTimeReport {
FlightTimeReport -> Int
_flightsTotal ::
Int
, FlightTimeReport -> TimeAmount
_hoursTotal ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursTotalICUS ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursTotalDual ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursTotalInCommand ::
TimeAmount
, FlightTimeReport
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
_hoursInAircraftType ::
Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
, FlightTimeReport
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
_hoursInAircraftRegistration ::
Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
, ::
TimeAmount
, ::
TimeAmount
, ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursSingleEngineInCommand ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursMultiEngine ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursMultiEngineICUS ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursMultiEngineDual ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursMultiEngineInCommand ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursDay ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursDayICUS ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursDayDual ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursDayInCommand ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursInstructing ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursGAInstructing ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursGA1Instructing ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursGA2Instructing ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursGA3Instructing ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursRAInstructing ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursRAJuniorInstructing ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursRASeniorInstructing ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursNight ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursNightICUS ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursNightDual ::
TimeAmount
, FlightTimeReport -> TimeAmount
_hoursNightInCommand ::
TimeAmount
, FlightTimeReport -> Map Aviator TimeAmount
_hoursWithPiC ::
Map Aviator TimeAmount
, FlightTimeReport -> TimeAmount
_hoursInstrument ::
TimeAmount
} deriving (FlightTimeReport -> FlightTimeReport -> Bool
(FlightTimeReport -> FlightTimeReport -> Bool)
-> (FlightTimeReport -> FlightTimeReport -> Bool)
-> Eq FlightTimeReport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FlightTimeReport -> FlightTimeReport -> Bool
== :: FlightTimeReport -> FlightTimeReport -> Bool
$c/= :: FlightTimeReport -> FlightTimeReport -> Bool
/= :: FlightTimeReport -> FlightTimeReport -> Bool
Eq, Eq FlightTimeReport
Eq FlightTimeReport =>
(FlightTimeReport -> FlightTimeReport -> Ordering)
-> (FlightTimeReport -> FlightTimeReport -> Bool)
-> (FlightTimeReport -> FlightTimeReport -> Bool)
-> (FlightTimeReport -> FlightTimeReport -> Bool)
-> (FlightTimeReport -> FlightTimeReport -> Bool)
-> (FlightTimeReport -> FlightTimeReport -> FlightTimeReport)
-> (FlightTimeReport -> FlightTimeReport -> FlightTimeReport)
-> Ord FlightTimeReport
FlightTimeReport -> FlightTimeReport -> Bool
FlightTimeReport -> FlightTimeReport -> Ordering
FlightTimeReport -> FlightTimeReport -> FlightTimeReport
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
$ccompare :: FlightTimeReport -> FlightTimeReport -> Ordering
compare :: FlightTimeReport -> FlightTimeReport -> Ordering
$c< :: FlightTimeReport -> FlightTimeReport -> Bool
< :: FlightTimeReport -> FlightTimeReport -> Bool
$c<= :: FlightTimeReport -> FlightTimeReport -> Bool
<= :: FlightTimeReport -> FlightTimeReport -> Bool
$c> :: FlightTimeReport -> FlightTimeReport -> Bool
> :: FlightTimeReport -> FlightTimeReport -> Bool
$c>= :: FlightTimeReport -> FlightTimeReport -> Bool
>= :: FlightTimeReport -> FlightTimeReport -> Bool
$cmax :: FlightTimeReport -> FlightTimeReport -> FlightTimeReport
max :: FlightTimeReport -> FlightTimeReport -> FlightTimeReport
$cmin :: FlightTimeReport -> FlightTimeReport -> FlightTimeReport
min :: FlightTimeReport -> FlightTimeReport -> FlightTimeReport
Ord, Int -> FlightTimeReport -> ShowS
[FlightTimeReport] -> ShowS
FlightTimeReport -> String
(Int -> FlightTimeReport -> ShowS)
-> (FlightTimeReport -> String)
-> ([FlightTimeReport] -> ShowS)
-> Show FlightTimeReport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FlightTimeReport -> ShowS
showsPrec :: Int -> FlightTimeReport -> ShowS
$cshow :: FlightTimeReport -> String
show :: FlightTimeReport -> String
$cshowList :: [FlightTimeReport] -> ShowS
showList :: [FlightTimeReport] -> ShowS
Show)
instance Semigroup FlightTimeReport where
FlightTimeReport Int
ft1 TimeAmount
tl1 TimeAmount
tli1 TimeAmount
tld1 TimeAmount
tlc1 Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
tp1 Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
rg1 TimeAmount
se1 TimeAmount
sei1 TimeAmount
sed1 TimeAmount
sec1 TimeAmount
me1 TimeAmount
mei1 TimeAmount
med1 TimeAmount
mec1 TimeAmount
dy1 TimeAmount
dyi1 TimeAmount
dyd1 TimeAmount
dyc1 TimeAmount
ins1 TimeAmount
insg1 TimeAmount
insg1_1 TimeAmount
insg1_2 TimeAmount
insg1_3 TimeAmount
insr1 TimeAmount
insr1_j TimeAmount
insr1_s TimeAmount
nt1 TimeAmount
nti1 TimeAmount
ntd1 TimeAmount
ntc1 Map Aviator TimeAmount
wpc1 TimeAmount
is1 <> :: FlightTimeReport -> FlightTimeReport -> FlightTimeReport
<> FlightTimeReport Int
ft2 TimeAmount
tl2 TimeAmount
tli2 TimeAmount
tld2 TimeAmount
tlc2 Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
tp2 Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
rg2 TimeAmount
se2 TimeAmount
sei2 TimeAmount
sed2 TimeAmount
sec2 TimeAmount
me2 TimeAmount
mei2 TimeAmount
med2 TimeAmount
mec2 TimeAmount
dy2 TimeAmount
dyi2 TimeAmount
dyd2 TimeAmount
dyc2 TimeAmount
ins2 TimeAmount
insg2 TimeAmount
insg2_1 TimeAmount
insg2_2 TimeAmount
insg2_3 TimeAmount
insr2 TimeAmount
insr2_j TimeAmount
insr2_s TimeAmount
nt2 TimeAmount
nti2 TimeAmount
ntd2 TimeAmount
ntc2 Map Aviator TimeAmount
wpc2 TimeAmount
is2 =
Int
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> Map Aviator TimeAmount
-> TimeAmount
-> FlightTimeReport
FlightTimeReport
(Int
ft1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
ft2)
(TimeAmount
tl1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
tl2)
(TimeAmount
tli1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
tli2)
(TimeAmount
tld1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
tld2)
(TimeAmount
tlc1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
tlc2)
(((TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> (TimeAmount, TimeAmount, TimeAmount, TimeAmount))
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
Map.unionWith (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
forall a. Monoid a => a -> a -> a
mappend Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
tp1 Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
tp2)
(((TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> (TimeAmount, TimeAmount, TimeAmount, TimeAmount))
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
Map.unionWith (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
forall a. Monoid a => a -> a -> a
mappend Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
rg1 Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
rg2)
(TimeAmount
se1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
se2)
(TimeAmount
sei1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
sei2)
(TimeAmount
sed1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
sed2)
(TimeAmount
sec1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
sec2)
(TimeAmount
me1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
me2)
(TimeAmount
mei1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
mei2)
(TimeAmount
med1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
med2)
(TimeAmount
mec1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
mec2)
(TimeAmount
dy1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
dy2)
(TimeAmount
dyi1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
dyi2)
(TimeAmount
dyd1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
dyd2)
(TimeAmount
dyc1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
dyc2)
(TimeAmount
ins1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
ins2)
(TimeAmount
insg1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
insg2)
(TimeAmount
insg1_1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
insg2_1)
(TimeAmount
insg1_2 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
insg2_2)
(TimeAmount
insg1_3 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
insg2_3)
(TimeAmount
insr1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
insr2)
(TimeAmount
insr1_j TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
insr2_j)
(TimeAmount
insr1_s TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
insr2_s)
(TimeAmount
nt1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
nt2)
(TimeAmount
nti1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
nti2)
(TimeAmount
ntd1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
ntd2)
(TimeAmount
ntc1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
ntc2)
((TimeAmount -> TimeAmount -> TimeAmount)
-> Map Aviator TimeAmount
-> Map Aviator TimeAmount
-> Map Aviator TimeAmount
forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
Map.unionWith TimeAmount -> TimeAmount -> TimeAmount
forall a. Monoid a => a -> a -> a
mappend Map Aviator TimeAmount
wpc1 Map Aviator TimeAmount
wpc2)
(TimeAmount
is1 TimeAmount -> TimeAmount -> TimeAmount
forall a. Semigroup a => a -> a -> a
<> TimeAmount
is2)
instance Monoid FlightTimeReport where
mempty :: FlightTimeReport
mempty =
Int
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> Map Aviator TimeAmount
-> TimeAmount
-> FlightTimeReport
FlightTimeReport
Int
0
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
forall a. Monoid a => a
mempty
Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
Map Aviator TimeAmount
forall a. Monoid a => a
mempty
TimeAmount
forall a. Monoid a => a
mempty
mappend :: FlightTimeReport -> FlightTimeReport -> FlightTimeReport
mappend =
FlightTimeReport -> FlightTimeReport -> FlightTimeReport
forall a. Semigroup a => a -> a -> a
(<>)
singleFlightTimeReport ::
Entry a b c d
-> FlightTimeReport
singleFlightTimeReport :: forall a b c d. Entry a b c d -> FlightTimeReport
singleFlightTimeReport (AircraftFlightEntry AircraftFlight
fl a
_) =
let hoursdaynight :: TimeAmount
hoursdaynight = DayNight -> TimeAmount
totalDayNight (AircraftFlight -> DayNight
aeronauticalHours AircraftFlight
fl)
icus :: p -> p
icus p
x =
case Getting (First Aviator) AircraftFlight Aviator
-> AircraftFlight -> Maybe Aviator
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First Aviator) Command)
-> AircraftFlight -> Const (First Aviator) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First Aviator) Command)
-> AircraftFlight -> Const (First Aviator) AircraftFlight)
-> ((Aviator -> Const (First Aviator) Aviator)
-> Command -> Const (First Aviator) Command)
-> Getting (First Aviator) AircraftFlight Aviator
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Aviator -> Const (First Aviator) Aviator)
-> Command -> Const (First Aviator) Command
forall r. AsCommand r => Prism' r Aviator
Prism' Command Aviator
_ICUS) AircraftFlight
fl of
Just Aviator
_ ->
p
x
Maybe Aviator
Nothing ->
p
forall a. Monoid a => a
mempty
dual :: p -> p
dual p
x =
case Getting (First Aviator) AircraftFlight Aviator
-> AircraftFlight -> Maybe Aviator
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First Aviator) Command)
-> AircraftFlight -> Const (First Aviator) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First Aviator) Command)
-> AircraftFlight -> Const (First Aviator) AircraftFlight)
-> ((Aviator -> Const (First Aviator) Aviator)
-> Command -> Const (First Aviator) Command)
-> Getting (First Aviator) AircraftFlight Aviator
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Aviator -> Const (First Aviator) Aviator)
-> Command -> Const (First Aviator) Command
forall r. AsCommand r => Prism' r Aviator
Prism' Command Aviator
_Dual) AircraftFlight
fl of
Just Aviator
_ ->
p
x
Maybe Aviator
Nothing ->
p
forall a. Monoid a => a
mempty
comd :: p -> p
comd p
x =
case Getting
(First (Maybe Instruction)) AircraftFlight (Maybe Instruction)
-> AircraftFlight -> Maybe (Maybe Instruction)
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First (Maybe Instruction)) Command)
-> AircraftFlight
-> Const (First (Maybe Instruction)) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First (Maybe Instruction)) Command)
-> AircraftFlight
-> Const (First (Maybe Instruction)) AircraftFlight)
-> ((Maybe Instruction
-> Const (First (Maybe Instruction)) (Maybe Instruction))
-> Command -> Const (First (Maybe Instruction)) Command)
-> Getting
(First (Maybe Instruction)) AircraftFlight (Maybe Instruction)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Maybe Instruction
-> Const (First (Maybe Instruction)) (Maybe Instruction))
-> Command -> Const (First (Maybe Instruction)) Command
forall c. AsCommand c => Prism' c (Maybe Instruction)
Prism' Command (Maybe Instruction)
_InCommandIncludingInstructing) AircraftFlight
fl of
Just Maybe Instruction
_ ->
p
x
Maybe (Maybe Instruction)
Nothing ->
p
forall a. Monoid a => a
mempty
instr :: p -> p
instr p
x =
case Getting (First Instruction) AircraftFlight Instruction
-> AircraftFlight -> Maybe Instruction
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight)
-> ((Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command)
-> Getting (First Instruction) AircraftFlight Instruction
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command
forall r. AsCommand r => Prism' r Instruction
Prism' Command Instruction
_InCommandInstructing) AircraftFlight
fl of
Just Instruction
_ ->
p
x
Maybe Instruction
Nothing ->
case Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
-> AircraftFlight -> Maybe (Aviator, InstructionRating)
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight)
-> (((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command)
-> Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command
forall r. AsCommand r => Prism' r (Aviator, InstructionRating)
Prism' Command (Aviator, InstructionRating)
_ApprovedSolo) AircraftFlight
fl of
Just (Aviator
_, InstructionRating
_) ->
p
x
Maybe (Aviator, InstructionRating)
Nothing ->
p
forall a. Monoid a => a
mempty
instrRA :: p -> p
instrRA p
x =
case Getting (First Instruction) AircraftFlight Instruction
-> AircraftFlight -> Maybe Instruction
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight)
-> ((Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command)
-> Getting (First Instruction) AircraftFlight Instruction
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command
forall r. AsCommand r => Prism' r Instruction
Prism' Command Instruction
_InCommandInstructing) AircraftFlight
fl of
Just Instruction
a ->
if InstructionRating -> Bool
forall a. AsInstructionRating a => a -> Bool
isRAInstruction (Getting InstructionRating Instruction InstructionRating
-> Instruction -> InstructionRating
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting InstructionRating Instruction InstructionRating
forall c. HasInstructionRating c => Lens' c InstructionRating
Lens' Instruction InstructionRating
instructionRating Instruction
a) then p
x else p
forall a. Monoid a => a
mempty
Maybe Instruction
Nothing ->
case Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
-> AircraftFlight -> Maybe (Aviator, InstructionRating)
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight)
-> (((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command)
-> Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command
forall r. AsCommand r => Prism' r (Aviator, InstructionRating)
Prism' Command (Aviator, InstructionRating)
_ApprovedSolo) AircraftFlight
fl of
Just (Aviator
_, InstructionRating
r) ->
if InstructionRating -> Bool
forall a. AsInstructionRating a => a -> Bool
isRAInstruction InstructionRating
r then p
x else p
forall a. Monoid a => a
mempty
Maybe (Aviator, InstructionRating)
Nothing ->
p
forall a. Monoid a => a
mempty
instrGA :: p -> p
instrGA p
x =
case Getting (First Instruction) AircraftFlight Instruction
-> AircraftFlight -> Maybe Instruction
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight)
-> ((Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command)
-> Getting (First Instruction) AircraftFlight Instruction
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command
forall r. AsCommand r => Prism' r Instruction
Prism' Command Instruction
_InCommandInstructing) AircraftFlight
fl of
Just Instruction
a ->
if InstructionRating -> Bool
forall a. AsInstructionRating a => a -> Bool
isGAInstruction (Getting InstructionRating Instruction InstructionRating
-> Instruction -> InstructionRating
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting InstructionRating Instruction InstructionRating
forall c. HasInstructionRating c => Lens' c InstructionRating
Lens' Instruction InstructionRating
instructionRating Instruction
a) then p
x else p
forall a. Monoid a => a
mempty
Maybe Instruction
Nothing ->
case Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
-> AircraftFlight -> Maybe (Aviator, InstructionRating)
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight)
-> (((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command)
-> Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command
forall r. AsCommand r => Prism' r (Aviator, InstructionRating)
Prism' Command (Aviator, InstructionRating)
_ApprovedSolo) AircraftFlight
fl of
Just (Aviator
_, InstructionRating
r) ->
if InstructionRating -> Bool
forall a. AsInstructionRating a => a -> Bool
isGAInstruction InstructionRating
r then p
x else p
forall a. Monoid a => a
mempty
Maybe (Aviator, InstructionRating)
Nothing ->
p
forall a. Monoid a => a
mempty
instrRAJunior :: a -> a
instrRAJunior a
x =
case Getting (First Instruction) AircraftFlight Instruction
-> AircraftFlight -> Maybe Instruction
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight)
-> ((Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command)
-> Getting (First Instruction) AircraftFlight Instruction
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command
forall r. AsCommand r => Prism' r Instruction
Prism' Command Instruction
_InCommandInstructing) AircraftFlight
fl of
Just Instruction
a ->
if APrism InstructionRating InstructionRating () ()
-> InstructionRating -> Bool
forall s t a b. APrism s t a b -> s -> Bool
isn't APrism InstructionRating InstructionRating () ()
forall r. AsInstructionRating r => Prism' r ()
Prism' InstructionRating ()
_RAInstructionRating (Getting InstructionRating Instruction InstructionRating
-> Instruction -> InstructionRating
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting InstructionRating Instruction InstructionRating
forall c. HasInstructionRating c => Lens' c InstructionRating
Lens' Instruction InstructionRating
instructionRating Instruction
a) then a
forall a. Monoid a => a
mempty else a
x
Maybe Instruction
Nothing ->
case Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
-> AircraftFlight -> Maybe (Aviator, InstructionRating)
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight)
-> (((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command)
-> Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command
forall r. AsCommand r => Prism' r (Aviator, InstructionRating)
Prism' Command (Aviator, InstructionRating)
_ApprovedSolo) AircraftFlight
fl of
Just (Aviator
_, InstructionRating
r) ->
if APrism InstructionRating InstructionRating () ()
-> InstructionRating -> Bool
forall s t a b. APrism s t a b -> s -> Bool
isn't APrism InstructionRating InstructionRating () ()
forall r. AsInstructionRating r => Prism' r ()
Prism' InstructionRating ()
_RAInstructionRating InstructionRating
r then a
forall a. Monoid a => a
mempty else a
x
Maybe (Aviator, InstructionRating)
Nothing ->
a
forall a. Monoid a => a
mempty
instrRASenior :: a -> a
instrRASenior a
x =
case Getting (First Instruction) AircraftFlight Instruction
-> AircraftFlight -> Maybe Instruction
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight)
-> ((Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command)
-> Getting (First Instruction) AircraftFlight Instruction
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command
forall r. AsCommand r => Prism' r Instruction
Prism' Command Instruction
_InCommandInstructing) AircraftFlight
fl of
Just Instruction
a ->
if APrism InstructionRating InstructionRating () ()
-> InstructionRating -> Bool
forall s t a b. APrism s t a b -> s -> Bool
isn't APrism InstructionRating InstructionRating () ()
forall r. AsInstructionRating r => Prism' r ()
Prism' InstructionRating ()
_RASIInstructionRating (Getting InstructionRating Instruction InstructionRating
-> Instruction -> InstructionRating
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting InstructionRating Instruction InstructionRating
forall c. HasInstructionRating c => Lens' c InstructionRating
Lens' Instruction InstructionRating
instructionRating Instruction
a) then a
forall a. Monoid a => a
mempty else a
x
Maybe Instruction
Nothing ->
case Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
-> AircraftFlight -> Maybe (Aviator, InstructionRating)
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight)
-> (((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command)
-> Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command
forall r. AsCommand r => Prism' r (Aviator, InstructionRating)
Prism' Command (Aviator, InstructionRating)
_ApprovedSolo) AircraftFlight
fl of
Just (Aviator
_, InstructionRating
r) ->
if APrism InstructionRating InstructionRating () ()
-> InstructionRating -> Bool
forall s t a b. APrism s t a b -> s -> Bool
isn't APrism InstructionRating InstructionRating () ()
forall r. AsInstructionRating r => Prism' r ()
Prism' InstructionRating ()
_RASIInstructionRating InstructionRating
r then a
forall a. Monoid a => a
mempty else a
x
Maybe (Aviator, InstructionRating)
Nothing ->
a
forall a. Monoid a => a
mempty
instrGA1 :: a -> a
instrGA1 a
x =
case Getting (First Instruction) AircraftFlight Instruction
-> AircraftFlight -> Maybe Instruction
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight)
-> ((Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command)
-> Getting (First Instruction) AircraftFlight Instruction
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command
forall r. AsCommand r => Prism' r Instruction
Prism' Command Instruction
_InCommandInstructing) AircraftFlight
fl of
Just Instruction
a ->
if APrism InstructionRating InstructionRating () ()
-> InstructionRating -> Bool
forall s t a b. APrism s t a b -> s -> Bool
isn't APrism InstructionRating InstructionRating () ()
forall r. AsInstructionRating r => Prism' r ()
Prism' InstructionRating ()
_GA1InstructionRating (Getting InstructionRating Instruction InstructionRating
-> Instruction -> InstructionRating
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting InstructionRating Instruction InstructionRating
forall c. HasInstructionRating c => Lens' c InstructionRating
Lens' Instruction InstructionRating
instructionRating Instruction
a) then a
forall a. Monoid a => a
mempty else a
x
Maybe Instruction
Nothing ->
case Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
-> AircraftFlight -> Maybe (Aviator, InstructionRating)
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight)
-> (((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command)
-> Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command
forall r. AsCommand r => Prism' r (Aviator, InstructionRating)
Prism' Command (Aviator, InstructionRating)
_ApprovedSolo) AircraftFlight
fl of
Just (Aviator
_, InstructionRating
r) ->
if APrism InstructionRating InstructionRating () ()
-> InstructionRating -> Bool
forall s t a b. APrism s t a b -> s -> Bool
isn't APrism InstructionRating InstructionRating () ()
forall r. AsInstructionRating r => Prism' r ()
Prism' InstructionRating ()
_GA1InstructionRating InstructionRating
r then a
forall a. Monoid a => a
mempty else a
x
Maybe (Aviator, InstructionRating)
Nothing ->
a
forall a. Monoid a => a
mempty
instrGA2 :: a -> a
instrGA2 a
x =
case Getting (First Instruction) AircraftFlight Instruction
-> AircraftFlight -> Maybe Instruction
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight)
-> ((Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command)
-> Getting (First Instruction) AircraftFlight Instruction
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command
forall r. AsCommand r => Prism' r Instruction
Prism' Command Instruction
_InCommandInstructing) AircraftFlight
fl of
Just Instruction
a ->
if APrism InstructionRating InstructionRating () ()
-> InstructionRating -> Bool
forall s t a b. APrism s t a b -> s -> Bool
isn't APrism InstructionRating InstructionRating () ()
forall r. AsInstructionRating r => Prism' r ()
Prism' InstructionRating ()
_GA2InstructionRating (Getting InstructionRating Instruction InstructionRating
-> Instruction -> InstructionRating
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting InstructionRating Instruction InstructionRating
forall c. HasInstructionRating c => Lens' c InstructionRating
Lens' Instruction InstructionRating
instructionRating Instruction
a) then a
forall a. Monoid a => a
mempty else a
x
Maybe Instruction
Nothing ->
case Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
-> AircraftFlight -> Maybe (Aviator, InstructionRating)
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight)
-> (((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command)
-> Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command
forall r. AsCommand r => Prism' r (Aviator, InstructionRating)
Prism' Command (Aviator, InstructionRating)
_ApprovedSolo) AircraftFlight
fl of
Just (Aviator
_, InstructionRating
r) ->
if APrism InstructionRating InstructionRating () ()
-> InstructionRating -> Bool
forall s t a b. APrism s t a b -> s -> Bool
isn't APrism InstructionRating InstructionRating () ()
forall r. AsInstructionRating r => Prism' r ()
Prism' InstructionRating ()
_GA2InstructionRating InstructionRating
r then a
forall a. Monoid a => a
mempty else a
x
Maybe (Aviator, InstructionRating)
Nothing ->
a
forall a. Monoid a => a
mempty
instrGA3 :: a -> a
instrGA3 a
x =
case Getting (First Instruction) AircraftFlight Instruction
-> AircraftFlight -> Maybe Instruction
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First Instruction) Command)
-> AircraftFlight -> Const (First Instruction) AircraftFlight)
-> ((Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command)
-> Getting (First Instruction) AircraftFlight Instruction
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Instruction -> Const (First Instruction) Instruction)
-> Command -> Const (First Instruction) Command
forall r. AsCommand r => Prism' r Instruction
Prism' Command Instruction
_InCommandInstructing) AircraftFlight
fl of
Just Instruction
a ->
if APrism InstructionRating InstructionRating () ()
-> InstructionRating -> Bool
forall s t a b. APrism s t a b -> s -> Bool
isn't APrism InstructionRating InstructionRating () ()
forall r. AsInstructionRating r => Prism' r ()
Prism' InstructionRating ()
_GA3InstructionRating (Getting InstructionRating Instruction InstructionRating
-> Instruction -> InstructionRating
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting InstructionRating Instruction InstructionRating
forall c. HasInstructionRating c => Lens' c InstructionRating
Lens' Instruction InstructionRating
instructionRating Instruction
a) then a
forall a. Monoid a => a
mempty else a
x
Maybe Instruction
Nothing ->
case Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
-> AircraftFlight -> Maybe (Aviator, InstructionRating)
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command ((Command -> Const (First (Aviator, InstructionRating)) Command)
-> AircraftFlight
-> Const (First (Aviator, InstructionRating)) AircraftFlight)
-> (((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command)
-> Getting
(First (Aviator, InstructionRating))
AircraftFlight
(Aviator, InstructionRating)
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. ((Aviator, InstructionRating)
-> Const
(First (Aviator, InstructionRating)) (Aviator, InstructionRating))
-> Command -> Const (First (Aviator, InstructionRating)) Command
forall r. AsCommand r => Prism' r (Aviator, InstructionRating)
Prism' Command (Aviator, InstructionRating)
_ApprovedSolo) AircraftFlight
fl of
Just (Aviator
_, InstructionRating
r) ->
if APrism InstructionRating InstructionRating () ()
-> InstructionRating -> Bool
forall s t a b. APrism s t a b -> s -> Bool
isn't APrism InstructionRating InstructionRating () ()
forall r. AsInstructionRating r => Prism' r ()
Prism' InstructionRating ()
_GA3InstructionRating InstructionRating
r then a
forall a. Monoid a => a
mempty else a
x
Maybe (Aviator, InstructionRating)
Nothing ->
a
forall a. Monoid a => a
mempty
hoursmap :: k -> Map k (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
hoursmap k
k =
k
-> (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> Map k (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
forall k a. k -> a -> Map k a
Map.singleton k
k (TimeAmount
hoursdaynight, TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
icus TimeAmount
hoursdaynight, TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
dual TimeAmount
hoursdaynight, TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
comd TimeAmount
hoursdaynight)
singleengine :: p -> p
singleengine p
x =
case Getting (First ()) AircraftFlight () -> AircraftFlight -> Maybe ()
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Aircraft -> Const (First ()) Aircraft)
-> AircraftFlight -> Const (First ()) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Aircraft
Lens' AircraftFlight Aircraft
flightaircraft ((Aircraft -> Const (First ()) Aircraft)
-> AircraftFlight -> Const (First ()) AircraftFlight)
-> ((() -> Const (First ()) ())
-> Aircraft -> Const (First ()) Aircraft)
-> Getting (First ()) AircraftFlight ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Engine -> Const (First ()) Engine)
-> Aircraft -> Const (First ()) Aircraft
forall c. HasAircraft c => Lens' c Engine
Lens' Aircraft Engine
aircraftEngine ((Engine -> Const (First ()) Engine)
-> Aircraft -> Const (First ()) Aircraft)
-> ((() -> Const (First ()) ())
-> Engine -> Const (First ()) Engine)
-> (() -> Const (First ()) ())
-> Aircraft
-> Const (First ()) Aircraft
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (() -> Const (First ()) ()) -> Engine -> Const (First ()) Engine
forall r. AsEngine r => Prism' r ()
Prism' Engine ()
_Single) AircraftFlight
fl of
Just ()
_ ->
p
x
Maybe ()
Nothing ->
p
forall a. Monoid a => a
mempty
multiengine :: p -> p
multiengine p
x =
case Getting (First ()) AircraftFlight () -> AircraftFlight -> Maybe ()
forall s (m :: * -> *) a.
MonadReader s m =>
Getting (First a) s a -> m (Maybe a)
preview ((Aircraft -> Const (First ()) Aircraft)
-> AircraftFlight -> Const (First ()) AircraftFlight
forall c. HasAircraftFlight c => Lens' c Aircraft
Lens' AircraftFlight Aircraft
flightaircraft ((Aircraft -> Const (First ()) Aircraft)
-> AircraftFlight -> Const (First ()) AircraftFlight)
-> ((() -> Const (First ()) ())
-> Aircraft -> Const (First ()) Aircraft)
-> Getting (First ()) AircraftFlight ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (Engine -> Const (First ()) Engine)
-> Aircraft -> Const (First ()) Aircraft
forall c. HasAircraft c => Lens' c Engine
Lens' Aircraft Engine
aircraftEngine ((Engine -> Const (First ()) Engine)
-> Aircraft -> Const (First ()) Aircraft)
-> ((() -> Const (First ()) ())
-> Engine -> Const (First ()) Engine)
-> (() -> Const (First ()) ())
-> Aircraft
-> Const (First ()) Aircraft
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (() -> Const (First ()) ()) -> Engine -> Const (First ()) Engine
forall r. AsEngine r => Prism' r ()
Prism' Engine ()
_Multi) AircraftFlight
fl of
Just ()
_ ->
p
x
Maybe ()
Nothing ->
p
forall a. Monoid a => a
mempty
totalhoursday :: TimeAmount
totalhoursday =
AircraftFlight
fl AircraftFlight
-> Getting TimeAmount AircraftFlight TimeAmount -> TimeAmount
forall s a. s -> Getting a s a -> a
^. (DayNight -> Const TimeAmount DayNight)
-> AircraftFlight -> Const TimeAmount AircraftFlight
forall c. HasAircraftFlight c => Lens' c DayNight
Lens' AircraftFlight DayNight
daynight ((DayNight -> Const TimeAmount DayNight)
-> AircraftFlight -> Const TimeAmount AircraftFlight)
-> ((TimeAmount -> Const TimeAmount TimeAmount)
-> DayNight -> Const TimeAmount DayNight)
-> Getting TimeAmount AircraftFlight TimeAmount
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (TimeAmount -> Const TimeAmount TimeAmount)
-> DayNight -> Const TimeAmount DayNight
forall c. HasDayNight c => Lens' c TimeAmount
Lens' DayNight TimeAmount
dayDayNight
totalhoursnight :: TimeAmount
totalhoursnight =
AircraftFlight
fl AircraftFlight
-> Getting TimeAmount AircraftFlight TimeAmount -> TimeAmount
forall s a. s -> Getting a s a -> a
^. (DayNight -> Const TimeAmount DayNight)
-> AircraftFlight -> Const TimeAmount AircraftFlight
forall c. HasAircraftFlight c => Lens' c DayNight
Lens' AircraftFlight DayNight
daynight ((DayNight -> Const TimeAmount DayNight)
-> AircraftFlight -> Const TimeAmount AircraftFlight)
-> ((TimeAmount -> Const TimeAmount TimeAmount)
-> DayNight -> Const TimeAmount DayNight)
-> Getting TimeAmount AircraftFlight TimeAmount
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (TimeAmount -> Const TimeAmount TimeAmount)
-> DayNight -> Const TimeAmount DayNight
forall c. HasDayNight c => Lens' c TimeAmount
Lens' DayNight TimeAmount
nightDayNight
pic :: a -> Map Aviator a
pic a
x =
case Command -> Maybe Aviator
getUnderInstructionPic (AircraftFlight
fl AircraftFlight -> Getting Command AircraftFlight Command -> Command
forall s a. s -> Getting a s a -> a
^. Getting Command AircraftFlight Command
forall c. HasAircraftFlight c => Lens' c Command
Lens' AircraftFlight Command
command) of
Just Aviator
a ->
Aviator -> a -> Map Aviator a
forall k a. k -> a -> Map k a
Map.singleton Aviator
a a
x
Maybe Aviator
Nothing ->
Map Aviator a
forall k a. Map k a
Map.empty
in Int
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> TimeAmount
-> Map Aviator TimeAmount
-> TimeAmount
-> FlightTimeReport
FlightTimeReport
Int
1
TimeAmount
hoursdaynight
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
icus TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
dual TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
comd TimeAmount
hoursdaynight)
(String
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
forall {k}.
k -> Map k (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
hoursmap (AircraftFlight
fl AircraftFlight -> Getting String AircraftFlight String -> String
forall s a. s -> Getting a s a -> a
^. (Aircraft -> Const String Aircraft)
-> AircraftFlight -> Const String AircraftFlight
forall c. HasAircraftFlight c => Lens' c Aircraft
Lens' AircraftFlight Aircraft
flightaircraft ((Aircraft -> Const String Aircraft)
-> AircraftFlight -> Const String AircraftFlight)
-> ((String -> Const String String)
-> Aircraft -> Const String Aircraft)
-> Getting String AircraftFlight String
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (String -> Const String String)
-> Aircraft -> Const String Aircraft
forall c. HasAircraft c => Lens' c String
Lens' Aircraft String
aircraftType))
(String
-> Map String (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
forall {k}.
k -> Map k (TimeAmount, TimeAmount, TimeAmount, TimeAmount)
hoursmap (AircraftFlight
fl AircraftFlight -> Getting String AircraftFlight String -> String
forall s a. s -> Getting a s a -> a
^. (Aircraft -> Const String Aircraft)
-> AircraftFlight -> Const String AircraftFlight
forall c. HasAircraftFlight c => Lens' c Aircraft
Lens' AircraftFlight Aircraft
flightaircraft ((Aircraft -> Const String Aircraft)
-> AircraftFlight -> Const String AircraftFlight)
-> ((String -> Const String String)
-> Aircraft -> Const String Aircraft)
-> Getting String AircraftFlight String
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. (String -> Const String String)
-> Aircraft -> Const String Aircraft
forall c. HasAircraft c => Lens' c String
Lens' Aircraft String
aircraftRegistration))
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
singleengine TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
singleengine (TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
icus TimeAmount
hoursdaynight))
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
singleengine (TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
dual TimeAmount
hoursdaynight))
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
singleengine (TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
comd TimeAmount
hoursdaynight))
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
multiengine TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
multiengine (TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
icus TimeAmount
hoursdaynight))
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
multiengine (TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
dual TimeAmount
hoursdaynight))
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
multiengine (TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
comd TimeAmount
hoursdaynight))
TimeAmount
totalhoursday
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
icus TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
dual TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
comd TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
instr TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
instrGA TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
instrGA1 TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
instrGA2 TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
instrGA3 TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
instrRA TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
instrRAJunior TimeAmount
hoursdaynight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
instrRASenior TimeAmount
hoursdaynight)
TimeAmount
totalhoursnight
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
icus TimeAmount
totalhoursnight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
dual TimeAmount
totalhoursnight)
(TimeAmount -> TimeAmount
forall {p}. Monoid p => p -> p
comd TimeAmount
totalhoursnight)
(TimeAmount -> Map Aviator TimeAmount
forall {a}. a -> Map Aviator a
pic TimeAmount
hoursdaynight)
(AircraftFlight
fl AircraftFlight
-> Getting TimeAmount AircraftFlight TimeAmount -> TimeAmount
forall s a. s -> Getting a s a -> a
^. Getting TimeAmount AircraftFlight TimeAmount
forall c. HasAircraftFlight c => Lens' c TimeAmount
Lens' AircraftFlight TimeAmount
instrumentflightTime)
singleFlightTimeReport Entry a b c d
_ =
FlightTimeReport
forall a. Monoid a => a
mempty
getFlightTimeReport ::
Logbook a b c d
-> FlightTimeReport
getFlightTimeReport :: forall a b c d. Logbook a b c d -> FlightTimeReport
getFlightTimeReport (Logbook Aviator
_ (Entries [Entry a b c d]
es)) =
(FlightTimeReport -> Entry a b c d -> FlightTimeReport)
-> FlightTimeReport -> [Entry a b c d] -> FlightTimeReport
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' (\FlightTimeReport
a -> FlightTimeReport -> FlightTimeReport -> FlightTimeReport
forall a. Monoid a => a -> a -> a
mappend FlightTimeReport
a (FlightTimeReport -> FlightTimeReport)
-> (Entry a b c d -> FlightTimeReport)
-> Entry a b c d
-> FlightTimeReport
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Entry a b c d -> FlightTimeReport
forall a b c d. Entry a b c d -> FlightTimeReport
singleFlightTimeReport) FlightTimeReport
forall a. Monoid a => a
mempty [Entry a b c d]
es