    {-# LANGUAGE DeriveDataTypeable #-}
    {-# LANGUAGE DeriveGeneric      #-}
    module Distribution.Solver.Types.OptionalStanza (
        -- * OptionalStanza
        OptionalStanza(..),
        showStanza,
        showStanzas,
        enableStanzas,
        -- * Set of stanzas
        OptionalStanzaSet,
        optStanzaSetFromList,
        optStanzaSetToList,
        optStanzaSetMember,
        optStanzaSetInsert,
        optStanzaSetSingleton,
        optStanzaSetIntersection,
        optStanzaSetNull,
        optStanzaSetIsSubset,
        -- * Map indexed by stanzas
        OptionalStanzaMap,
        optStanzaTabulate,
        optStanzaIndex,
        optStanzaLookup,
        optStanzaKeysFilteredByValue,
    ) where

    import Distribution.Solver.Compat.Prelude
    import Prelude ()

    import Data.Bits                                 (testBit, (.|.), (.&.))
    import Distribution.Types.ComponentRequestedSpec (ComponentRequestedSpec (..))
    import Distribution.Utils.Structured (Structured (..), nominalStructure)

    -------------------------------------------------------------------------------
    -- OptionalStanza
    -------------------------------------------------------------------------------

    data OptionalStanza
        = TestStanzas
        | BenchStanzas
      deriving (OptionalStanza -> OptionalStanza -> Bool
    (OptionalStanza -> OptionalStanza -> Bool)
    -> (OptionalStanza -> OptionalStanza -> Bool) -> Eq OptionalStanza
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: OptionalStanza -> OptionalStanza -> Bool
    == :: OptionalStanza -> OptionalStanza -> Bool
    $c/= :: OptionalStanza -> OptionalStanza -> Bool
    /= :: OptionalStanza -> OptionalStanza -> Bool
    Eq, Eq OptionalStanza
    Eq OptionalStanza =>
    (OptionalStanza -> OptionalStanza -> Ordering)
    -> (OptionalStanza -> OptionalStanza -> Bool)
    -> (OptionalStanza -> OptionalStanza -> Bool)
    -> (OptionalStanza -> OptionalStanza -> Bool)
    -> (OptionalStanza -> OptionalStanza -> Bool)
    -> (OptionalStanza -> OptionalStanza -> OptionalStanza)
    -> (OptionalStanza -> OptionalStanza -> OptionalStanza)
    -> Ord OptionalStanza
    OptionalStanza -> OptionalStanza -> Bool
    OptionalStanza -> OptionalStanza -> Ordering
    OptionalStanza -> OptionalStanza -> OptionalStanza
    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 :: OptionalStanza -> OptionalStanza -> Ordering
    compare :: OptionalStanza -> OptionalStanza -> Ordering
    $c< :: OptionalStanza -> OptionalStanza -> Bool
    < :: OptionalStanza -> OptionalStanza -> Bool
    $c<= :: OptionalStanza -> OptionalStanza -> Bool
    <= :: OptionalStanza -> OptionalStanza -> Bool
    $c> :: OptionalStanza -> OptionalStanza -> Bool
    > :: OptionalStanza -> OptionalStanza -> Bool
    $c>= :: OptionalStanza -> OptionalStanza -> Bool
    >= :: OptionalStanza -> OptionalStanza -> Bool
    $cmax :: OptionalStanza -> OptionalStanza -> OptionalStanza
    max :: OptionalStanza -> OptionalStanza -> OptionalStanza
    $cmin :: OptionalStanza -> OptionalStanza -> OptionalStanza
    min :: OptionalStanza -> OptionalStanza -> OptionalStanza
    Ord, Int -> OptionalStanza
    OptionalStanza -> Int
    OptionalStanza -> [OptionalStanza]
    OptionalStanza -> OptionalStanza
    OptionalStanza -> OptionalStanza -> [OptionalStanza]
    OptionalStanza
    -> OptionalStanza -> OptionalStanza -> [OptionalStanza]
    (OptionalStanza -> OptionalStanza)
    -> (OptionalStanza -> OptionalStanza)
    -> (Int -> OptionalStanza)
    -> (OptionalStanza -> Int)
    -> (OptionalStanza -> [OptionalStanza])
    -> (OptionalStanza -> OptionalStanza -> [OptionalStanza])
    -> (OptionalStanza -> OptionalStanza -> [OptionalStanza])
    -> (OptionalStanza
        -> OptionalStanza -> OptionalStanza -> [OptionalStanza])
    -> Enum OptionalStanza
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: OptionalStanza -> OptionalStanza
    succ :: OptionalStanza -> OptionalStanza
    $cpred :: OptionalStanza -> OptionalStanza
    pred :: OptionalStanza -> OptionalStanza
    $ctoEnum :: Int -> OptionalStanza
    toEnum :: Int -> OptionalStanza
    $cfromEnum :: OptionalStanza -> Int
    fromEnum :: OptionalStanza -> Int
    $cenumFrom :: OptionalStanza -> [OptionalStanza]
    enumFrom :: OptionalStanza -> [OptionalStanza]
    $cenumFromThen :: OptionalStanza -> OptionalStanza -> [OptionalStanza]
    enumFromThen :: OptionalStanza -> OptionalStanza -> [OptionalStanza]
    $cenumFromTo :: OptionalStanza -> OptionalStanza -> [OptionalStanza]
    enumFromTo :: OptionalStanza -> OptionalStanza -> [OptionalStanza]
    $cenumFromThenTo :: OptionalStanza
    -> OptionalStanza -> OptionalStanza -> [OptionalStanza]
    enumFromThenTo :: OptionalStanza
    -> OptionalStanza -> OptionalStanza -> [OptionalStanza]
    Enum, OptionalStanza
    OptionalStanza -> OptionalStanza -> Bounded OptionalStanza
    forall a. a -> a -> Bounded a
    $cminBound :: OptionalStanza
    minBound :: OptionalStanza
    $cmaxBound :: OptionalStanza
    maxBound :: OptionalStanza
    Bounded, Int -> OptionalStanza -> ShowS
    [OptionalStanza] -> ShowS
    OptionalStanza -> String
    (Int -> OptionalStanza -> ShowS)
    -> (OptionalStanza -> String)
    -> ([OptionalStanza] -> ShowS)
    -> Show OptionalStanza
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> OptionalStanza -> ShowS
    showsPrec :: Int -> OptionalStanza -> ShowS
    $cshow :: OptionalStanza -> String
    show :: OptionalStanza -> String
    $cshowList :: [OptionalStanza] -> ShowS
    showList :: [OptionalStanza] -> ShowS
    Show, (forall x. OptionalStanza -> Rep OptionalStanza x)
    -> (forall x. Rep OptionalStanza x -> OptionalStanza)
    -> Generic OptionalStanza
    forall x. Rep OptionalStanza x -> OptionalStanza
    forall x. OptionalStanza -> Rep OptionalStanza x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. OptionalStanza -> Rep OptionalStanza x
    from :: forall x. OptionalStanza -> Rep OptionalStanza x
    $cto :: forall x. Rep OptionalStanza x -> OptionalStanza
    to :: forall x. Rep OptionalStanza x -> OptionalStanza
    Generic, Typeable)

    -- | String representation of an OptionalStanza.
    showStanza :: OptionalStanza -> String
    showStanza :: OptionalStanza -> String
    showStanza OptionalStanza
    TestStanzas  = String
    "test"
    showStanza OptionalStanza
    BenchStanzas = String
    "bench"

    showStanzas :: OptionalStanzaSet -> String
    showStanzas :: OptionalStanzaSet -> String
    showStanzas = [String] -> String
    unwords ([String] -> String)
    -> (OptionalStanzaSet -> [String]) -> OptionalStanzaSet -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (OptionalStanza -> String) -> [OptionalStanza] -> [String]
    forall a b. (a -> b) -> [a] -> [b]
    map ((String
    "*" String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++) ShowS -> (OptionalStanza -> String) -> OptionalStanza -> String
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . OptionalStanza -> String
    showStanza) ([OptionalStanza] -> [String])
    -> (OptionalStanzaSet -> [OptionalStanza])
    -> OptionalStanzaSet
    -> [String]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . OptionalStanzaSet -> [OptionalStanza]
    optStanzaSetToList

    -- | Convert a list of 'OptionalStanza' into the corresponding
    -- Cabal's 'ComponentRequestedSpec' which records what components are enabled.
    --
    enableStanzas :: OptionalStanzaSet -> ComponentRequestedSpec
    enableStanzas :: OptionalStanzaSet -> ComponentRequestedSpec
    enableStanzas OptionalStanzaSet
    optionalStanzas = ComponentRequestedSpec
        { testsRequested :: Bool
    testsRequested      = OptionalStanza -> OptionalStanzaSet -> Bool
    optStanzaSetMember OptionalStanza
    TestStanzas  OptionalStanzaSet
    optionalStanzas
        , benchmarksRequested :: Bool
    benchmarksRequested = OptionalStanza -> OptionalStanzaSet -> Bool
    optStanzaSetMember OptionalStanza
    BenchStanzas OptionalStanzaSet
    optionalStanzas
        }

    instance Binary OptionalStanza
    instance Structured OptionalStanza

    -------------------------------------------------------------------------------
    -- OptionalStanzaSet
    -------------------------------------------------------------------------------

    newtype OptionalStanzaSet = OptionalStanzaSet Word
      deriving (OptionalStanzaSet -> OptionalStanzaSet -> Bool
    (OptionalStanzaSet -> OptionalStanzaSet -> Bool)
    -> (OptionalStanzaSet -> OptionalStanzaSet -> Bool)
    -> Eq OptionalStanzaSet
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    == :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    $c/= :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    /= :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    Eq, Eq OptionalStanzaSet
    Eq OptionalStanzaSet =>
    (OptionalStanzaSet -> OptionalStanzaSet -> Ordering)
    -> (OptionalStanzaSet -> OptionalStanzaSet -> Bool)
    -> (OptionalStanzaSet -> OptionalStanzaSet -> Bool)
    -> (OptionalStanzaSet -> OptionalStanzaSet -> Bool)
    -> (OptionalStanzaSet -> OptionalStanzaSet -> Bool)
    -> (OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet)
    -> (OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet)
    -> Ord OptionalStanzaSet
    OptionalStanzaSet -> OptionalStanzaSet -> Bool
    OptionalStanzaSet -> OptionalStanzaSet -> Ordering
    OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    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 :: OptionalStanzaSet -> OptionalStanzaSet -> Ordering
    compare :: OptionalStanzaSet -> OptionalStanzaSet -> Ordering
    $c< :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    < :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    $c<= :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    <= :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    $c> :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    > :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    $c>= :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    >= :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    $cmax :: OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    max :: OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    $cmin :: OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    min :: OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    Ord, Int -> OptionalStanzaSet -> ShowS
    [OptionalStanzaSet] -> ShowS
    OptionalStanzaSet -> String
    (Int -> OptionalStanzaSet -> ShowS)
    -> (OptionalStanzaSet -> String)
    -> ([OptionalStanzaSet] -> ShowS)
    -> Show OptionalStanzaSet
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> OptionalStanzaSet -> ShowS
    showsPrec :: Int -> OptionalStanzaSet -> ShowS
    $cshow :: OptionalStanzaSet -> String
    show :: OptionalStanzaSet -> String
    $cshowList :: [OptionalStanzaSet] -> ShowS
    showList :: [OptionalStanzaSet] -> ShowS
    Show)

    instance Binary OptionalStanzaSet where
        put :: OptionalStanzaSet -> Put
    put (OptionalStanzaSet Word
    w) = Word -> Put
    forall t. Binary t => t -> Put
    put Word
    w
        get :: Get OptionalStanzaSet
    get = (Word -> OptionalStanzaSet) -> Get Word -> Get OptionalStanzaSet
    forall a b. (a -> b) -> Get a -> Get b
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    fmap (Word -> OptionalStanzaSet
    OptionalStanzaSet (Word -> OptionalStanzaSet)
    -> (Word -> Word) -> Word -> OptionalStanzaSet
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (Word -> Word -> Word
    forall a. Bits a => a -> a -> a
    .&. Word
    0x03)) Get Word
    forall t. Binary t => Get t
    get

    instance Structured OptionalStanzaSet where
        structure :: Proxy OptionalStanzaSet -> Structure
    structure = Proxy OptionalStanzaSet -> Structure
    forall {k} (a :: k). Typeable a => Proxy a -> Structure
    nominalStructure

    optStanzaSetFromList :: [OptionalStanza] -> OptionalStanzaSet
    optStanzaSetFromList :: [OptionalStanza] -> OptionalStanzaSet
    optStanzaSetFromList = (OptionalStanzaSet -> OptionalStanza -> OptionalStanzaSet)
    -> OptionalStanzaSet -> [OptionalStanza] -> OptionalStanzaSet
    forall b a. (b -> a -> b) -> b -> [a] -> b
    forall (t :: * -> *) b a.
    Foldable t =>
    (b -> a -> b) -> b -> t a -> b
    foldl' ((OptionalStanza -> OptionalStanzaSet -> OptionalStanzaSet)
    -> OptionalStanzaSet -> OptionalStanza -> OptionalStanzaSet
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip OptionalStanza -> OptionalStanzaSet -> OptionalStanzaSet
    optStanzaSetInsert) OptionalStanzaSet
    forall a. Monoid a => a
    mempty

    optStanzaSetToList :: OptionalStanzaSet -> [OptionalStanza]
    optStanzaSetToList :: OptionalStanzaSet -> [OptionalStanza]
    optStanzaSetToList (OptionalStanzaSet Word
    0) = []
    optStanzaSetToList (OptionalStanzaSet Word
    1) = [OptionalStanza
    TestStanzas]
    optStanzaSetToList (OptionalStanzaSet Word
    2) = [OptionalStanza
    BenchStanzas]
    optStanzaSetToList (OptionalStanzaSet Word
    3) = [OptionalStanza
    TestStanzas, OptionalStanza
    BenchStanzas]
    optStanzaSetToList (OptionalStanzaSet Word
    _) = []

    optStanzaSetInsert :: OptionalStanza -> OptionalStanzaSet -> OptionalStanzaSet
    optStanzaSetInsert :: OptionalStanza -> OptionalStanzaSet -> OptionalStanzaSet
    optStanzaSetInsert OptionalStanza
    x OptionalStanzaSet
    s = OptionalStanza -> OptionalStanzaSet
    optStanzaSetSingleton OptionalStanza
    x OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    forall a. Semigroup a => a -> a -> a
    <> OptionalStanzaSet
    s

    optStanzaSetMember :: OptionalStanza -> OptionalStanzaSet -> Bool
    optStanzaSetMember :: OptionalStanza -> OptionalStanzaSet -> Bool
    optStanzaSetMember OptionalStanza
    TestStanzas  (OptionalStanzaSet Word
    w) = Word -> Int -> Bool
    forall a. Bits a => a -> Int -> Bool
    testBit Word
    w Int
    0
    optStanzaSetMember OptionalStanza
    BenchStanzas (OptionalStanzaSet Word
    w) = Word -> Int -> Bool
    forall a. Bits a => a -> Int -> Bool
    testBit Word
    w Int
    1

    optStanzaSetSingleton :: OptionalStanza -> OptionalStanzaSet
    optStanzaSetSingleton :: OptionalStanza -> OptionalStanzaSet
    optStanzaSetSingleton OptionalStanza
    TestStanzas  = Word -> OptionalStanzaSet
    OptionalStanzaSet Word
    1
    optStanzaSetSingleton OptionalStanza
    BenchStanzas = Word -> OptionalStanzaSet
    OptionalStanzaSet Word
    2

    optStanzaSetIntersection :: OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    optStanzaSetIntersection :: OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    optStanzaSetIntersection (OptionalStanzaSet Word
    a) (OptionalStanzaSet Word
    b) = Word -> OptionalStanzaSet
    OptionalStanzaSet (Word
    a Word -> Word -> Word
    forall a. Bits a => a -> a -> a
    .&. Word
    b)

    optStanzaSetNull :: OptionalStanzaSet -> Bool
    optStanzaSetNull :: OptionalStanzaSet -> Bool
    optStanzaSetNull (OptionalStanzaSet Word
    w) = Word
    w Word -> Word -> Bool
    forall a. Eq a => a -> a -> Bool
    == Word
    0

    optStanzaSetIsSubset :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    optStanzaSetIsSubset :: OptionalStanzaSet -> OptionalStanzaSet -> Bool
    optStanzaSetIsSubset (OptionalStanzaSet Word
    a) (OptionalStanzaSet Word
    b) = (Word
    a Word -> Word -> Word
    forall a. Bits a => a -> a -> a
    .|. Word
    b) Word -> Word -> Bool
    forall a. Eq a => a -> a -> Bool
    == Word
    b

    instance Semigroup OptionalStanzaSet where
        OptionalStanzaSet Word
    a <> :: OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    <> OptionalStanzaSet Word
    b = Word -> OptionalStanzaSet
    OptionalStanzaSet (Word
    a Word -> Word -> Word
    forall a. Bits a => a -> a -> a
    .|. Word
    b)

    instance Monoid OptionalStanzaSet where
        mempty :: OptionalStanzaSet
    mempty = Word -> OptionalStanzaSet
    OptionalStanzaSet Word
    0
        mappend :: OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    mappend = OptionalStanzaSet -> OptionalStanzaSet -> OptionalStanzaSet
    forall a. Semigroup a => a -> a -> a
    (<>)

    -------------------------------------------------------------------------------
    -- OptionalStanzaMap
    -------------------------------------------------------------------------------

    -- | Note: this is total map.
    data OptionalStanzaMap a = OptionalStanzaMap a a
      deriving (OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    (OptionalStanzaMap a -> OptionalStanzaMap a -> Bool)
    -> (OptionalStanzaMap a -> OptionalStanzaMap a -> Bool)
    -> Eq (OptionalStanzaMap a)
    forall a.
    Eq a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: forall a.
    Eq a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    == :: OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    $c/= :: forall a.
    Eq a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    /= :: OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    Eq, Eq (OptionalStanzaMap a)
    Eq (OptionalStanzaMap a) =>
    (OptionalStanzaMap a -> OptionalStanzaMap a -> Ordering)
    -> (OptionalStanzaMap a -> OptionalStanzaMap a -> Bool)
    -> (OptionalStanzaMap a -> OptionalStanzaMap a -> Bool)
    -> (OptionalStanzaMap a -> OptionalStanzaMap a -> Bool)
    -> (OptionalStanzaMap a -> OptionalStanzaMap a -> Bool)
    -> (OptionalStanzaMap a
        -> OptionalStanzaMap a -> OptionalStanzaMap a)
    -> (OptionalStanzaMap a
        -> OptionalStanzaMap a -> OptionalStanzaMap a)
    -> Ord (OptionalStanzaMap a)
    OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    OptionalStanzaMap a -> OptionalStanzaMap a -> Ordering
    OptionalStanzaMap a -> OptionalStanzaMap a -> OptionalStanzaMap a
    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
    forall a. Ord a => Eq (OptionalStanzaMap a)
    forall a.
    Ord a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    forall a.
    Ord a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> Ordering
    forall a.
    Ord a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> OptionalStanzaMap a
    $ccompare :: forall a.
    Ord a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> Ordering
    compare :: OptionalStanzaMap a -> OptionalStanzaMap a -> Ordering
    $c< :: forall a.
    Ord a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    < :: OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    $c<= :: forall a.
    Ord a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    <= :: OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    $c> :: forall a.
    Ord a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    > :: OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    $c>= :: forall a.
    Ord a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    >= :: OptionalStanzaMap a -> OptionalStanzaMap a -> Bool
    $cmax :: forall a.
    Ord a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> OptionalStanzaMap a
    max :: OptionalStanzaMap a -> OptionalStanzaMap a -> OptionalStanzaMap a
    $cmin :: forall a.
    Ord a =>
    OptionalStanzaMap a -> OptionalStanzaMap a -> OptionalStanzaMap a
    min :: OptionalStanzaMap a -> OptionalStanzaMap a -> OptionalStanzaMap a
    Ord, Int -> OptionalStanzaMap a -> ShowS
    [OptionalStanzaMap a] -> ShowS
    OptionalStanzaMap a -> String
    (Int -> OptionalStanzaMap a -> ShowS)
    -> (OptionalStanzaMap a -> String)
    -> ([OptionalStanzaMap a] -> ShowS)
    -> Show (OptionalStanzaMap a)
    forall a. Show a => Int -> OptionalStanzaMap a -> ShowS
    forall a. Show a => [OptionalStanzaMap a] -> ShowS
    forall a. Show a => OptionalStanzaMap a -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: forall a. Show a => Int -> OptionalStanzaMap a -> ShowS
    showsPrec :: Int -> OptionalStanzaMap a -> ShowS
    $cshow :: forall a. Show a => OptionalStanzaMap a -> String
    show :: OptionalStanzaMap a -> String
    $cshowList :: forall a. Show a => [OptionalStanzaMap a] -> ShowS
    showList :: [OptionalStanzaMap a] -> ShowS
    Show, (forall x. OptionalStanzaMap a -> Rep (OptionalStanzaMap a) x)
    -> (forall x. Rep (OptionalStanzaMap a) x -> OptionalStanzaMap a)
    -> Generic (OptionalStanzaMap a)
    forall x. Rep (OptionalStanzaMap a) x -> OptionalStanzaMap a
    forall x. OptionalStanzaMap a -> Rep (OptionalStanzaMap a) x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    forall a x. Rep (OptionalStanzaMap a) x -> OptionalStanzaMap a
    forall a x. OptionalStanzaMap a -> Rep (OptionalStanzaMap a) x
    $cfrom :: forall a x. OptionalStanzaMap a -> Rep (OptionalStanzaMap a) x
    from :: forall x. OptionalStanzaMap a -> Rep (OptionalStanzaMap a) x
    $cto :: forall a x. Rep (OptionalStanzaMap a) x -> OptionalStanzaMap a
    to :: forall x. Rep (OptionalStanzaMap a) x -> OptionalStanzaMap a
    Generic)

    instance Binary a => Binary (OptionalStanzaMap a)
    instance Structured a => Structured (OptionalStanzaMap a)

    optStanzaTabulate :: (OptionalStanza -> a) -> OptionalStanzaMap a
    optStanzaTabulate :: forall a. (OptionalStanza -> a) -> OptionalStanzaMap a
    optStanzaTabulate OptionalStanza -> a
    f = a -> a -> OptionalStanzaMap a
    forall a. a -> a -> OptionalStanzaMap a
    OptionalStanzaMap (OptionalStanza -> a
    f OptionalStanza
    TestStanzas) (OptionalStanza -> a
    f OptionalStanza
    BenchStanzas)

    optStanzaIndex :: OptionalStanzaMap a -> OptionalStanza -> a
    optStanzaIndex :: forall a. OptionalStanzaMap a -> OptionalStanza -> a
    optStanzaIndex (OptionalStanzaMap a
    x a
    _) OptionalStanza
    TestStanzas  = a
    x
    optStanzaIndex (OptionalStanzaMap a
    _ a
    x) OptionalStanza
    BenchStanzas = a
    x

    optStanzaLookup :: OptionalStanza -> OptionalStanzaMap a -> a
    optStanzaLookup :: forall a. OptionalStanza -> OptionalStanzaMap a -> a
    optStanzaLookup = (OptionalStanzaMap a -> OptionalStanza -> a)
    -> OptionalStanza -> OptionalStanzaMap a -> a
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip OptionalStanzaMap a -> OptionalStanza -> a
    forall a. OptionalStanzaMap a -> OptionalStanza -> a
    optStanzaIndex

    optStanzaKeysFilteredByValue :: (a -> Bool) -> OptionalStanzaMap a -> OptionalStanzaSet
    optStanzaKeysFilteredByValue :: forall a. (a -> Bool) -> OptionalStanzaMap a -> OptionalStanzaSet
    optStanzaKeysFilteredByValue a -> Bool
    p (OptionalStanzaMap a
    x a
    y)
        | a -> Bool
    p a
    x       = if a -> Bool
    p a
    y then Word -> OptionalStanzaSet
    OptionalStanzaSet Word
    3 else Word -> OptionalStanzaSet
    OptionalStanzaSet Word
    1
        | Bool
    otherwise = if a -> Bool
    p a
    y then Word -> OptionalStanzaSet
    OptionalStanzaSet Word
    2 else Word -> OptionalStanzaSet
    OptionalStanzaSet Word
    0