    module Test.Framework.Runners.Options (
            module Test.Framework.Runners.Options,
            TestPattern
        ) where

    import Test.Framework.Options
    import Test.Framework.Utilities
    import Test.Framework.Runners.TestPattern

    import Data.Monoid ( Last(Last, getLast) )
    import Data.Semigroup as Sem ( Semigroup((<>)) )

    data ColorMode = ColorAuto | ColorNever | ColorAlways

    type RunnerOptions = RunnerOptions' Maybe
    type CompleteRunnerOptions = RunnerOptions' K
    data RunnerOptions' f = RunnerOptions {
            forall (f :: * -> *). RunnerOptions' f -> f Int
    ropt_threads :: f Int,
            forall (f :: * -> *). RunnerOptions' f -> f TestOptions
    ropt_test_options :: f TestOptions,
            forall (f :: * -> *). RunnerOptions' f -> f [TestPattern]
    ropt_test_patterns :: f [TestPattern],
            forall (f :: * -> *). RunnerOptions' f -> f (Maybe FilePath)
    ropt_xml_output :: f (Maybe FilePath),
            forall (f :: * -> *). RunnerOptions' f -> f Bool
    ropt_xml_nested :: f Bool,
            forall (f :: * -> *). RunnerOptions' f -> f ColorMode
    ropt_color_mode :: f ColorMode,
            forall (f :: * -> *). RunnerOptions' f -> f Bool
    ropt_hide_successes :: f Bool,
            forall (f :: * -> *). RunnerOptions' f -> f Bool
    ropt_list_only  :: f Bool
        }

    instance Semigroup (RunnerOptions' Maybe) where
        RunnerOptions' Maybe
    ro1 <> :: RunnerOptions' Maybe
    -> RunnerOptions' Maybe -> RunnerOptions' Maybe
    <> RunnerOptions' Maybe
    ro2 = RunnerOptions {
                ropt_threads :: Maybe Int
    ropt_threads = Last Int -> Maybe Int
    forall a. Last a -> Maybe a
    getLast ((RunnerOptions' Maybe -> Last Int)
    -> RunnerOptions' Maybe -> RunnerOptions' Maybe -> Last Int
    forall b a. Monoid b => (a -> b) -> a -> a -> b
    mappendBy (Maybe Int -> Last Int
    forall a. Maybe a -> Last a
    Last (Maybe Int -> Last Int)
    -> (RunnerOptions' Maybe -> Maybe Int)
    -> RunnerOptions' Maybe
    -> Last Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . RunnerOptions' Maybe -> Maybe Int
    forall (f :: * -> *). RunnerOptions' f -> f Int
    ropt_threads) RunnerOptions' Maybe
    ro1 RunnerOptions' Maybe
    ro2),
                ropt_test_options :: Maybe TestOptions
    ropt_test_options = (RunnerOptions' Maybe -> Maybe TestOptions)
    -> RunnerOptions' Maybe
    -> RunnerOptions' Maybe
    -> Maybe TestOptions
    forall b a. Monoid b => (a -> b) -> a -> a -> b
    mappendBy RunnerOptions' Maybe -> Maybe TestOptions
    forall (f :: * -> *). RunnerOptions' f -> f TestOptions
    ropt_test_options RunnerOptions' Maybe
    ro1 RunnerOptions' Maybe
    ro2,
                ropt_test_patterns :: Maybe [TestPattern]
    ropt_test_patterns = (RunnerOptions' Maybe -> Maybe [TestPattern])
    -> RunnerOptions' Maybe
    -> RunnerOptions' Maybe
    -> Maybe [TestPattern]
    forall b a. Monoid b => (a -> b) -> a -> a -> b
    mappendBy RunnerOptions' Maybe -> Maybe [TestPattern]
    forall (f :: * -> *). RunnerOptions' f -> f [TestPattern]
    ropt_test_patterns RunnerOptions' Maybe
    ro1 RunnerOptions' Maybe
    ro2,
                ropt_xml_output :: Maybe (Maybe FilePath)
    ropt_xml_output = (RunnerOptions' Maybe -> Maybe (Maybe FilePath))
    -> RunnerOptions' Maybe
    -> RunnerOptions' Maybe
    -> Maybe (Maybe FilePath)
    forall b a. Monoid b => (a -> b) -> a -> a -> b
    mappendBy RunnerOptions' Maybe -> Maybe (Maybe FilePath)
    forall (f :: * -> *). RunnerOptions' f -> f (Maybe FilePath)
    ropt_xml_output RunnerOptions' Maybe
    ro1 RunnerOptions' Maybe
    ro2,
                ropt_xml_nested :: Maybe Bool
    ropt_xml_nested = Last Bool -> Maybe Bool
    forall a. Last a -> Maybe a
    getLast ((RunnerOptions' Maybe -> Last Bool)
    -> RunnerOptions' Maybe -> RunnerOptions' Maybe -> Last Bool
    forall b a. Monoid b => (a -> b) -> a -> a -> b
    mappendBy (Maybe Bool -> Last Bool
    forall a. Maybe a -> Last a
    Last (Maybe Bool -> Last Bool)
    -> (RunnerOptions' Maybe -> Maybe Bool)
    -> RunnerOptions' Maybe
    -> Last Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . RunnerOptions' Maybe -> Maybe Bool
    forall (f :: * -> *). RunnerOptions' f -> f Bool
    ropt_xml_nested) RunnerOptions' Maybe
    ro1 RunnerOptions' Maybe
    ro2),
                ropt_color_mode :: Maybe ColorMode
    ropt_color_mode = Last ColorMode -> Maybe ColorMode
    forall a. Last a -> Maybe a
    getLast ((RunnerOptions' Maybe -> Last ColorMode)
    -> RunnerOptions' Maybe -> RunnerOptions' Maybe -> Last ColorMode
    forall b a. Monoid b => (a -> b) -> a -> a -> b
    mappendBy (Maybe ColorMode -> Last ColorMode
    forall a. Maybe a -> Last a
    Last (Maybe ColorMode -> Last ColorMode)
    -> (RunnerOptions' Maybe -> Maybe ColorMode)
    -> RunnerOptions' Maybe
    -> Last ColorMode
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . RunnerOptions' Maybe -> Maybe ColorMode
    forall (f :: * -> *). RunnerOptions' f -> f ColorMode
    ropt_color_mode) RunnerOptions' Maybe
    ro1 RunnerOptions' Maybe
    ro2),
                ropt_hide_successes :: Maybe Bool
    ropt_hide_successes = Last Bool -> Maybe Bool
    forall a. Last a -> Maybe a
    getLast ((RunnerOptions' Maybe -> Last Bool)
    -> RunnerOptions' Maybe -> RunnerOptions' Maybe -> Last Bool
    forall b a. Monoid b => (a -> b) -> a -> a -> b
    mappendBy (Maybe Bool -> Last Bool
    forall a. Maybe a -> Last a
    Last (Maybe Bool -> Last Bool)
    -> (RunnerOptions' Maybe -> Maybe Bool)
    -> RunnerOptions' Maybe
    -> Last Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . RunnerOptions' Maybe -> Maybe Bool
    forall (f :: * -> *). RunnerOptions' f -> f Bool
    ropt_hide_successes) RunnerOptions' Maybe
    ro1 RunnerOptions' Maybe
    ro2),
                ropt_list_only :: Maybe Bool
    ropt_list_only      = Last Bool -> Maybe Bool
    forall a. Last a -> Maybe a
    getLast ((RunnerOptions' Maybe -> Last Bool)
    -> RunnerOptions' Maybe -> RunnerOptions' Maybe -> Last Bool
    forall b a. Monoid b => (a -> b) -> a -> a -> b
    mappendBy (Maybe Bool -> Last Bool
    forall a. Maybe a -> Last a
    Last (Maybe Bool -> Last Bool)
    -> (RunnerOptions' Maybe -> Maybe Bool)
    -> RunnerOptions' Maybe
    -> Last Bool
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . RunnerOptions' Maybe -> Maybe Bool
    forall (f :: * -> *). RunnerOptions' f -> f Bool
    ropt_list_only)      RunnerOptions' Maybe
    ro1 RunnerOptions' Maybe
    ro2)
            }

    instance Monoid (RunnerOptions' Maybe) where
        mempty :: RunnerOptions' Maybe
    mempty = RunnerOptions {
                ropt_threads :: Maybe Int
    ropt_threads = Maybe Int
    forall a. Maybe a
    Nothing,
                ropt_test_options :: Maybe TestOptions
    ropt_test_options = Maybe TestOptions
    forall a. Maybe a
    Nothing,
                ropt_test_patterns :: Maybe [TestPattern]
    ropt_test_patterns = Maybe [TestPattern]
    forall a. Maybe a
    Nothing,
                ropt_xml_output :: Maybe (Maybe FilePath)
    ropt_xml_output = Maybe (Maybe FilePath)
    forall a. Maybe a
    Nothing,
                ropt_xml_nested :: Maybe Bool
    ropt_xml_nested = Maybe Bool
    forall a. Maybe a
    Nothing,
                ropt_color_mode :: Maybe ColorMode
    ropt_color_mode = Maybe ColorMode
    forall a. Maybe a
    Nothing,
                ropt_hide_successes :: Maybe Bool
    ropt_hide_successes = Maybe Bool
    forall a. Maybe a
    Nothing,
                ropt_list_only :: Maybe Bool
    ropt_list_only      = Maybe Bool
    forall a. Maybe a
    Nothing
            }

        mappend :: RunnerOptions' Maybe
    -> RunnerOptions' Maybe -> RunnerOptions' Maybe
    mappend = RunnerOptions' Maybe
    -> RunnerOptions' Maybe -> RunnerOptions' Maybe
    forall a. Semigroup a => a -> a -> a
    (Sem.<>)