harg-0.2.0.0: Haskell program configuration using higher kinded data

Safe HaskellNone
LanguageHaskell2010

Options.Harg.Nested

Contents

Synopsis

Documentation

newtype Nested (b :: Type) (f :: Type -> Type) Source #

Newtype wrapper around HKD.

Constructors

Nested (HKD b f) 
Instances
ProductB (HKD b) => ProductB (Nested b :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Options.Harg.Nested

Methods

bprod :: Nested b f -> Nested b g -> Nested b (Product f g) #

buniq :: (forall (a :: k). f a) -> Nested b f #

TraversableB (HKD b) => TraversableB (Nested b :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Options.Harg.Nested

Methods

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

FunctorB (HKD b) => FunctorB (Nested b :: (Type -> Type) -> Type) Source # 
Instance details

Defined in Options.Harg.Nested

Methods

bmap :: (forall (a :: k). f a -> g a) -> Nested b f -> Nested b g #

Generic (HKD b f) => Generic (Nested b f) Source # 
Instance details

Defined in Options.Harg.Nested

Associated Types

type Rep (Nested b f) :: Type -> Type #

Methods

from :: Nested b f -> Rep (Nested b f) x #

to :: Rep (Nested b f) x -> Nested b f #

FromJSON (HKD b f) => FromJSON (Nested b f) Source # 
Instance details

Defined in Options.Harg.Nested

Methods

parseJSON :: Value -> Parser (Nested b f) #

parseJSONList :: Value -> Parser [Nested b f] #

type Rep (Nested b f) Source # 
Instance details

Defined in Options.Harg.Nested

type Rep (Nested b f) = Rep (HKD b f)

type family Nest (a :: Type) (f :: Type -> Type) = (res :: Type) | res -> a where ... Source #

Equations

Nest (a -> b) f = a -> Nest b f 
Nest (HKD a f) f = Nested a f 

nested :: forall b f k. (Build b f k, Coercible (HKD b f) (Nested b f), Coercible k (Nest k f)) => Nest k f Source #

See documentation for build

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

  someNestedValue :: Nested User Maybe
  someNestedValue
    = nested @User (Just Joe) (Just 30)

getNested :: Construct f b => Nested b f -> f b Source #

See documentation for construct

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

  getUserBack :: Maybe User
  getUserBack
    = getNested hkdUser
    where
      hkdUser :: Nested User Maybe
      hkdUser
        = nested @User (Just Joe) (Just 30)

Orphan instances

GFromJSON Zero (HKD_ f structure) => FromJSON (HKD structure f) Source # 
Instance details

Methods

parseJSON :: Value -> Parser (HKD structure f) #

parseJSONList :: Value -> Parser [HKD structure f] #