casa-reoc-0.1.0.0: src/ReOC/Data/TrainingArrangements.hs
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wall #-}
-- The checks of inheritance (inheritTrainingArrangements') have a constraint that their body does not use, by design.
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
-- | The data type @TrainingArrangements'@: how RePL training is conducted, as the RePL training manual sets out: where theory and practical training are conducted, student numbers, the instructor’s control of the RPA, the delivery of theory and examinations, the pass mark, the examiner of flight tests, and the simulator, if one is used.
module ReOC.Data.TrainingArrangements (
TrainingArrangements' (..),
TrainingArrangements'Like (..),
lawNamesTrainingArrangements',
TrainingArrangements,
UnfilledTrainingArrangements,
mkTrainingArrangements,
mkUnfilledTrainingArrangements,
InheritTrainingArrangements',
inheritTrainingArrangements',
) where
import Control.Lens (Optic, cloneLens, view)
import Data.Functor.Const (Const)
import Data.List.NonEmpty (NonEmpty)
import Data.Text (Text)
import Numeric.Natural (Natural)
import ReOC.Data.ExamDelivery (ExamDelivery)
import ReOC.Data.FlightTestExaminer (FlightTestExaminer)
import ReOC.Data.InstructorTakeover (InstructorTakeover)
import ReOC.Data.TheoryDelivery (TheoryDelivery)
import ReOC.Name.Exam (ExamLike (..))
import ReOC.Name.ExamPassMark (ExamPassMarkLike (..))
import ReOC.Name.Examiner (ExaminerLike (..))
import ReOC.Name.MaxStudentsPerCourse (MaxStudentsPerCourseLike (..))
import ReOC.Name.MaxStudentsPerInstructor (MaxStudentsPerInstructorLike (..))
import ReOC.Name.PracticalAreas (PracticalAreasLike (..))
import ReOC.Name.Simulator (SimulatorLike (..))
import ReOC.Name.Takeover (TakeoverLike (..))
import ReOC.Name.Theory (TheoryLike (..))
import ReOC.Name.TheoryVenues (TheoryVenuesLike (..))
import ReOC.Primitive.PassMark (PassMark)
import ReOC.Primitive.Positive (Positive)
import ReOC.Primitive.Text1 (Text1)
-- | How RePL training is conducted, as the RePL training manual sets out: where theory and practical training are conducted, student numbers, the instructor’s control of the RPA, the delivery of theory and examinations, the pass mark, the examiner of flight tests, and the simulator, if one is used. Its valid form is @TrainingArrangements@, and its unfilled form @UnfilledTrainingArrangements@.
data TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 = TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
deriving (Eq, Ord, Show)
-- | The name of the data type @TrainingArrangements'@.
class TrainingArrangements'Like p f x x' a1 a1' a2 a2' a3 a3' a4 a4' a5 a5' a6 a6' a7 a7' a8 a8' a9 a9' a10 a10' | x -> a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 where
trainingArrangements' ::
Optic p f x x' (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) (TrainingArrangements' a1' a2' a3' a4' a5' a6' a7' a8' a9' a10')
-- | Identity
instance (x' ~ TrainingArrangements' a1' a2' a3' a4' a5' a6' a7' a8' a9' a10') => TrainingArrangements'Like p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a1 a1' a2 a2' a3 a3' a4 a4' a5 a5' a6 a6' a7 a7' a8 a8' a9 a9' a10 a10' where
trainingArrangements' = id
-- | Lens
instance (p ~ (->), Functor f, x' ~ TrainingArrangements' a1' a2 a3 a4 a5 a6 a7 a8 a9 a10) => TheoryVenuesLike p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a1 a1' where
theoryVenues f (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) = fmap (\x1' -> TrainingArrangements' x1' x2 x3 x4 x5 x6 x7 x8 x9 x10) (f x1)
-- | Lens
instance (p ~ (->), Functor f, x' ~ TrainingArrangements' a1 a2' a3 a4 a5 a6 a7 a8 a9 a10) => PracticalAreasLike p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a2 a2' where
practicalAreas f (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) = fmap (\x2' -> TrainingArrangements' x1 x2' x3 x4 x5 x6 x7 x8 x9 x10) (f x2)
-- | Lens
instance (p ~ (->), Functor f, x' ~ TrainingArrangements' a1 a2 a3' a4 a5 a6 a7 a8 a9 a10) => MaxStudentsPerCourseLike p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a3 a3' where
maxStudentsPerCourse f (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) = fmap (\x3' -> TrainingArrangements' x1 x2 x3' x4 x5 x6 x7 x8 x9 x10) (f x3)
-- | Lens
instance (p ~ (->), Functor f, x' ~ TrainingArrangements' a1 a2 a3 a4' a5 a6 a7 a8 a9 a10) => MaxStudentsPerInstructorLike p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a4 a4' where
maxStudentsPerInstructor f (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) = fmap (\x4' -> TrainingArrangements' x1 x2 x3 x4' x5 x6 x7 x8 x9 x10) (f x4)
-- | Lens
instance (p ~ (->), Functor f, x' ~ TrainingArrangements' a1 a2 a3 a4 a5' a6 a7 a8 a9 a10) => TakeoverLike p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a5 a5' where
takeover f (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) = fmap (\x5' -> TrainingArrangements' x1 x2 x3 x4 x5' x6 x7 x8 x9 x10) (f x5)
-- | Lens
instance (p ~ (->), Functor f, x' ~ TrainingArrangements' a1 a2 a3 a4 a5 a6' a7 a8 a9 a10) => TheoryLike p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a6 a6' where
theory f (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) = fmap (\x6' -> TrainingArrangements' x1 x2 x3 x4 x5 x6' x7 x8 x9 x10) (f x6)
-- | Lens
instance (p ~ (->), Functor f, x' ~ TrainingArrangements' a1 a2 a3 a4 a5 a6 a7' a8 a9 a10) => ExamLike p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a7 a7' where
exam f (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) = fmap (\x7' -> TrainingArrangements' x1 x2 x3 x4 x5 x6 x7' x8 x9 x10) (f x7)
-- | Lens
instance (p ~ (->), Functor f, x' ~ TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8' a9 a10) => ExamPassMarkLike p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a8 a8' where
examPassMark f (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) = fmap (\x8' -> TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8' x9 x10) (f x8)
-- | Lens
instance (p ~ (->), Functor f, x' ~ TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9' a10) => ExaminerLike p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a9 a9' where
examiner f (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) = fmap (\x9' -> TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9' x10) (f x9)
-- | Lens
instance (p ~ (->), Functor f, x' ~ TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10') => SimulatorLike p f (TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) x' a10 a10' where
simulator f (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10) = fmap (TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9) (f x10)
{- | Rebuilds a value from the name of each field or constructor.
Laws:
> lawNamesTrainingArrangements' == id
-}
lawNamesTrainingArrangements' :: TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 -> TrainingArrangements' a1 a2 a3 a4 a5 a6 a7 a8 a9 a10
lawNamesTrainingArrangements' s =
TrainingArrangements'
(view (cloneLens theoryVenues) s)
(view (cloneLens practicalAreas) s)
(view (cloneLens maxStudentsPerCourse) s)
(view (cloneLens maxStudentsPerInstructor) s)
(view (cloneLens takeover) s)
(view (cloneLens theory) s)
(view (cloneLens exam) s)
(view (cloneLens examPassMark) s)
(view (cloneLens examiner) s)
(view (cloneLens simulator) s)
-- | A valid @TrainingArrangements'@.
type TrainingArrangements = TrainingArrangements' (NonEmpty Text1) (NonEmpty Text1) Positive Positive InstructorTakeover TheoryDelivery ExamDelivery PassMark FlightTestExaminer (Maybe Text1)
-- | An unfilled @TrainingArrangements'@: each field holds what has been entered, if anything, to be checked by @fillTrainingArrangements@.
type UnfilledTrainingArrangements = TrainingArrangements' [Text] [Text] (Maybe Natural) (Maybe Natural) (Maybe InstructorTakeover) (Maybe TheoryDelivery) (Maybe ExamDelivery) (Maybe Natural) (Maybe FlightTestExaminer) (Maybe Text)
-- | Builds a valid @TrainingArrangements'@ with every @Maybe@ field @Nothing@ and every list (or @AtMost@) field empty.
mkTrainingArrangements :: NonEmpty Text1 -> NonEmpty Text1 -> Positive -> Positive -> InstructorTakeover -> TheoryDelivery -> ExamDelivery -> PassMark -> FlightTestExaminer -> TrainingArrangements
mkTrainingArrangements x1 x2 x3 x4 x5 x6 x7 x8 x9 = TrainingArrangements' x1 x2 x3 x4 x5 x6 x7 x8 x9 Nothing
-- | An unfilled @TrainingArrangements'@ with nothing entered.
mkUnfilledTrainingArrangements :: UnfilledTrainingArrangements
mkUnfilledTrainingArrangements =
TrainingArrangements'
[]
[]
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
-- | The classes that a data type holding @TrainingArrangements'@ in one field, or in one or more constructors, inherits.
type InheritTrainingArrangements' s a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 =
( TrainingArrangements'Like (->) (Const ()) s s a1 a1 a2 a2 a3 a3 a4 a4 a5 a5 a6 a6 a7 a7 a8 a8 a9 a9 a10 a10
, TheoryVenuesLike (->) (Const ()) s s a1 a1
, PracticalAreasLike (->) (Const ()) s s a2 a2
, MaxStudentsPerCourseLike (->) (Const ()) s s a3 a3
, MaxStudentsPerInstructorLike (->) (Const ()) s s a4 a4
, TakeoverLike (->) (Const ()) s s a5 a5
, TheoryLike (->) (Const ()) s s a6 a6
, ExamLike (->) (Const ()) s s a7 a7
, ExamPassMarkLike (->) (Const ()) s s a8 a8
, ExaminerLike (->) (Const ()) s s a9 a9
, SimulatorLike (->) (Const ()) s s a10 a10
)
-- | Checks that a data type inherits every class of @InheritTrainingArrangements'@.
inheritTrainingArrangements' :: (InheritTrainingArrangements' s a1 a2 a3 a4 a5 a6 a7 a8 a9 a10) => proxy s -> ()
inheritTrainingArrangements' _ = ()