{-# LANGUAGE CPP, Rank2Types, ExistentialQuantification #-}
module Options.Applicative.NonEmpty (
some1
) where
import Data.List.NonEmpty (NonEmpty (..))
import Options.Applicative.Types
import Control.Applicative
import Prelude
some1 :: Parser a -> Parser (NonEmpty a)
some1 :: Parser a -> Parser (NonEmpty a)
some1 Parser a
p = ParserM (NonEmpty a) -> Parser (NonEmpty a)
forall a. ParserM a -> Parser a
fromM (ParserM (NonEmpty a) -> Parser (NonEmpty a))
-> ParserM (NonEmpty a) -> Parser (NonEmpty a)
forall a b. (a -> b) -> a -> b
$ a -> [a] -> NonEmpty a
forall a. a -> [a] -> NonEmpty a
(:|) (a -> [a] -> NonEmpty a)
-> ParserM a -> ParserM ([a] -> NonEmpty a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser a -> ParserM a
forall a. Parser a -> ParserM a
oneM Parser a
p ParserM ([a] -> NonEmpty a) -> ParserM [a] -> ParserM (NonEmpty a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Parser a -> ParserM [a]
forall a. Parser a -> ParserM [a]
manyM Parser a
p