harg-0.4.1.0: Haskell program configuration using higher kinded data

Safe HaskellNone
LanguageHaskell2010

Options.Harg.Single

Synopsis

Documentation

newtype Single (a :: Type) (f :: Type -> Type) Source #

Single a f is a newtype around f a, which allows mixing non-nested with nested values when creating configuration parsers, using :*.

  data User = User { name :: String, age :: Int }
    deriving Generic

  myConfig :: (Nested User :* Single Int) Opt
  myConfig
    =  nested @User nameOpt ageOpt
    :* single intOpt
    where
      ...

Constructors

Single 

Fields

Instances
ProductB (Single a :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Options.Harg.Single

Methods

bprod :: Single a f -> Single a g -> Single a (Product f g) #

buniq :: (forall (a0 :: k). f a0) -> Single a f #

TraversableB (Single a :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Options.Harg.Single

Methods

btraverse :: Applicative t => (forall (a0 :: k). f a0 -> t (g a0)) -> Single a f -> t (Single a g) #

FunctorB (Single a :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Options.Harg.Single

Methods

bmap :: (forall (a0 :: k). f a0 -> g a0) -> Single a f -> Single a g #

(Show a, Show (f a)) => Show (Single a f) Source # 
Instance details

Defined in Options.Harg.Single

Methods

showsPrec :: Int -> Single a f -> ShowS #

show :: Single a f -> String #

showList :: [Single a f] -> ShowS #

Generic (f a) => Generic (Single a f) Source # 
Instance details

Defined in Options.Harg.Single

Associated Types

type Rep (Single a f) :: Type -> Type #

Methods

from :: Single a f -> Rep (Single a f) x #

to :: Rep (Single a f) x -> Single a f #

FromJSON (f a) => FromJSON (Single a f) Source # 
Instance details

Defined in Options.Harg.Single

Methods

parseJSON :: Value -> Parser (Single a f) #

parseJSONList :: Value -> Parser [Single a f] #

type Rep (Single a f) Source # 
Instance details

Defined in Options.Harg.Single

type Rep (Single a f) = Rep (f a)

single :: f a -> Single a f Source #

Wrap a value into a Single.

fromSingle :: Single a Identity -> a Source #

Helper for when f ~ Identity