module Options.Applicative.NonEmpty (
  some1
) where

import Data.List.NonEmpty (NonEmpty (..))

import Options.Applicative.Types
import Control.Applicative
import Prelude

-- | Sequences an action one or more times.
--
--   Functionally identical to 'Data.List.NonEmpty.some1',
--   but is preferred as it gives a nicer help text.
some1 :: Parser a -> Parser (NonEmpty a)
some1 :: forall a. Parser a -> Parser (NonEmpty a)
some1 Parser a
p = forall a. ParserM a -> Parser a
fromM forall a b. (a -> b) -> a -> b
$ forall a. a -> [a] -> NonEmpty a
(:|) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Parser a -> ParserM a
oneM Parser a
p forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Parser a -> ParserM [a]
manyM Parser a
p