deferDefaultFlagChoices :: Tree a -> Tree a
deferDefaultFlagChoices = trav go
  where
    go (GoalChoiceF xs) = GoalChoiceF (P.sortBy defer xs)
    go x                = x

    defer :: Tree a -> Tree a -> Ordering
    defer (FChoice _ _ True _) _ = GT
    defer _ (FChoice _ _ True _) = LT
    defer _ _                    = EQ

-- | Variant of 'preferEasyGoalChoices'.
--
-- Only approximates the number of choices in the branches. Less accurate,
-- more efficient.
deferDefaultFlagChoices :: Tree a -> Tree a
deferDefaultFlagChoices = trav go
  where
    go (GoalChoiceF xs) = GoalChoiceF (P.sortBy defer xs)
    go x                = x

    defer :: Tree a -> Tree a -> Ordering
    defer (FChoice _ _ True _) _ = GT
    defer _ (FChoice _ _ True _) = LT
    defer _ _                    = EQ

-- | Variant of 'preferEasyGoalChoices'.
--
-- Only approximates the number of choices in the branches. Less accurate,
-- more efficient.
deferDefaultFlagChoices = trav go
  where
    go (GoalChoiceF xs) = GoalChoiceF (P.sortBy defer xs)
    go x                = x

    defer :: Tree a -> Tree a -> Ordering
    defer (FChoice _ _ True _) _ = GT
    defer _ (FChoice _ _ True _) = LT
    defer _ _                    = EQ

-- | Variant of 'preferEasyGoalChoices'.
--
-- Only approximates the number of choices in the branches. Less accurate,
-- more efficient.