resultAndStrings
  :: (Arbitrary a, Show a)

  => ([Either String (GroverOpt a)] -> Result)
  -- ^ Function that creates a Result

  -> String
  -- ^ Name of mode

  -> Gen (Either [String] Result, [String])
resultAndStrings fRes modeName = frequency [(1, nonMode), (4, withMode)]
  where
    nonMode = fmap (\ls -> (Left ls, ls)) genNonModePosArg
    withMode = do
      ispLine <- interspersedLine (genGroverOpt arbitrary) PosArg
      strings <- interspersedLineToStrings ispLine groverOptToNestedList
      return ( Right . fRes . map Right $ fst ispLine ++ snd ispLine
             , modeName : strings )
resultAndStrings
  :: (Arbitrary a, Show a)

  => ([Either String (GroverOpt a)] -> Result)
  -- ^ Function that creates a Result

  -> String
  -- ^ Name of mode

  -> Gen (Either [String] Result, [String])
resultAndStrings fRes modeName = frequency [(1, nonMode), (4, withMode)]
  where
    nonMode = fmap (\ls -> (Left ls, ls)) genNonModePosArg
    withMode = do
      ispLine <- interspersedLine (genGroverOpt arbitrary) PosArg
      strings <- interspersedLineToStrings ispLine groverOptToNestedList
      return ( Right . fRes . map Right $ fst ispLine ++ snd ispLine
             , modeName : strings )
resultAndStrings fRes modeName = frequency [(1, nonMode), (4, withMode)]
  where
    nonMode = fmap (\ls -> (Left ls, ls)) genNonModePosArg
    withMode = do
      ispLine <- interspersedLine (genGroverOpt arbitrary) PosArg
      strings <- interspersedLineToStrings ispLine groverOptToNestedList
      return ( Right . fRes . map Right $ fst ispLine ++ snd ispLine
             , modeName : strings )