config-schema-1.3.0.0: Schema definitions for the config-value package

Copyright | (c) Eric Mertens 2017
License | ISC
Maintainer | emertens@gmail.com
Safe Haskell | None
Language | Haskell2010

Config.Schema.Spec

Contents

- Specifying values
  - Key-value mapping specifications
  - Number specifications
  - Text specifications
  - Atom specifications
  - List specifications
- Specifying sections
- Re-exports

Description

This module provides a set of types and operations for defining configuration file schemas.

These specifications are can be consumed by Config.Schema.Load and Config.Schema.Docs.

This is the schema system used by the `glirc` IRC client https://hackage.haskell.org/package/glirc. For a significant example, visit the `Client.Configuration` and `Client.Configuration.Colors` modules.

Synopsis

- data ValueSpec a
- customSpec :: Text -> ValueSpec a -> (a -> Either Text b) -> ValueSpec b
- namedSpec :: Text -> ValueSpec a -> ValueSpec a
- exactSpec :: Value () -> ValueSpec ()
- class HasSpec a where
  - anySpec :: ValueSpec a
- sectionsSpec :: Text -> SectionsSpec a -> ValueSpec a
- assocSpec :: ValueSpec a -> ValueSpec [(Text, a)]
- numberSpec :: ValueSpec Number
- integerSpec :: ValueSpec Integer
- rationalSpec :: ValueSpec Rational
- naturalSpec :: ValueSpec Natural
- fractionalSpec :: Fractional a => ValueSpec a
- numSpec :: Num a => ValueSpec a
- textSpec :: ValueSpec Text
- stringSpec :: ValueSpec String
- atomSpec :: Text -> ValueSpec ()
- anyAtomSpec :: ValueSpec Text
- yesOrNoSpec :: ValueSpec Bool
- trueOrFalseSpec :: ValueSpec Bool
- listSpec :: ValueSpec a -> ValueSpec [a]
- oneOrList :: ValueSpec a -> ValueSpec [a]
- nonemptySpec :: ValueSpec a -> ValueSpec (NonEmpty a)
- oneOrNonemptySpec :: ValueSpec a -> ValueSpec (NonEmpty a)
- data SectionsSpec a
- reqSection :: HasSpec a => Text -> Text -> SectionsSpec a
- optSection :: HasSpec a => Text -> Text -> SectionsSpec (Maybe a)
- reqSection' :: Text -> ValueSpec a -> Text -> SectionsSpec a
- optSection' :: Text -> ValueSpec a -> Text -> SectionsSpec (Maybe a)
- class Functor f => Alt (f :: Type -> Type) where
  - (<!>) :: f a -> f a -> f a
  - some :: Applicative f => f a -> f [a]
  - many :: Applicative f => f a -> f [a]

# Specifying values

`ValueSpec` allows you to define specifications that will match parsed config-value configuration files. `ValueSpec` allows us to define the shape of configuration values that will match the specification as well as a way to process those matches.

Below we have an example configuration record that can be matched from a configuration file.

More documentation for defining key-value pairs is available below.

This configuration file expects either a given username or allows the user to ask for a random username. The (`<!>`) operator allows us to combine two alternatives as seen below. The config-value language distinguishes between atoms like `random` and strings like `"random"` allowing unambiguous special cases to be added in addition to free-form text.

    {-# Language RecordWildCards, OverloadedStrings, ApplicativeDo #-}
    module Example where

    import Config.Schema
    import Data.Functor.Alt ((<!>))
    import Data.Maybe       (fromMaybe)
    import Data.Text        (Text)

    data Config = Config
      { userName :: UserName
      , retries  :: Int
      }

    data UserName = Random | Given Text

    userNameSpec :: ValueSpec UserName
    userNameSpec = Random <$  atomSpec "random"
               <!> Given  <$> anySpec -- matches string literals

    nameExample :: ValueSpec Config
    nameExample = sectionsSpec "config" $

      do userName <- reqSection' "username" userNameSpec "Configured user name"

         retries  <- fromMaybe 3
                 <$> optSection "retries" "Number of attempts (default: 3)"

         pure Config{..}

Examples:

    username: random
    retries: 5
    -- Generates: Config { userName = Random, retries = 5 }

We can omit the retries:

    username: random
    -- Generates: Config { userName = Random, retries = 3 }

We can specify a specific username as a string literal instead of using the atom `random`:

    username: "me"
    -- Generates: Config { userName = Given "me", retries = 3 }

Sections can be reordered:

    retries: 5
    username: random
    -- Generates: Config { userName = Random, retries = 5 }

data ValueSpec a Source #

Non-empty disjunction of value specifications. This type is the primary way to specify expected values.

Multiple specifications can be combined using this type's `Alt` instance.

To create `ValueSpec` values see Config.Schema.Spec

#### Instances

Instances details

Functor ValueSpec Source # |
Instance details Defined in Config.Schema.Types Methods fmap :: (a -> b) -> ValueSpec a -> ValueSpec b Source # (<$) :: a -> ValueSpec b -> ValueSpec a Source #
Alt ValueSpec Source # | Left-biased choice between two specifications
Instance details Defined in Config.Schema.Types Methods (<!>) :: ValueSpec a -> ValueSpec a -> ValueSpec a Source # some :: Applicative ValueSpec => ValueSpec a -> ValueSpec [a] Source # many :: Applicative ValueSpec => ValueSpec a -> ValueSpec [a] Source #

customSpec :: Text -> ValueSpec a -> (a -> Either Text b) -> ValueSpec b Source #

The custom specification allows an arbitrary function to be used to validate the value extracted by a specification. If `Nothing` is returned the value is considered to have failed validation.

namedSpec Source #

Arguments

:: Text | name
-> ValueSpec a | underlying specification
-> ValueSpec a |

Named value specification. This is useful for factoring complicated value specifications out in the documentation to avoid repetition of complex specifications.

exactSpec :: Value () -> ValueSpec () Source #

Match an exact value. This can be used to match a specific text literal number literal, atom, list of exact things, etc.

class HasSpec a where Source #

Class of value specifications without parameters.

Methods

anySpec :: ValueSpec a Source #

#### Instances

Instances details

HasSpec Int16 Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Int16 Source #
HasSpec Int32 Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Int32 Source #
HasSpec Int64 Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Int64 Source #
HasSpec Int8 Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Int8 Source #
HasSpec Word16 Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Word16 Source #
HasSpec Word32 Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Word32 Source #
HasSpec Word64 Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Word64 Source #
HasSpec Word8 Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Word8 Source #
HasSpec Text Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Text Source #
HasSpec Integer Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Integer Source #
HasSpec Natural Source # | Since: 1.2.0.0
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Natural Source #
HasSpec Double Source # | Since: 1.2.0.0
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Double Source #
HasSpec Float Source # | Since: 1.2.0.0
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Float Source #
HasSpec Int Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Int Source #
HasSpec Word Source # |
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec Word Source #
HasSpec a => HasSpec (NonEmpty a) Source # | One or more elements in a list Since: 1.2.0.0
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec (NonEmpty a) Source #
Integral a => HasSpec (Ratio a) Source # | For `Ratio` and `Rational` Since: 1.2.0.0
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec (Ratio a) Source #
HasSpec a => HasSpec [a] Source # | Zero or more elements in a list
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec [a] Source #
(HasSpec a, HasSpec b) => HasSpec (Either a b) Source # | Left-biased, untagged union of specs
Instance details Defined in Config.Schema.Spec Methods anySpec :: ValueSpec (Either a b) Source #

## Key-value mapping specifications

Specifications that match key-value map literals.

sectionsSpec Source #

Arguments

:: Text | unique documentation identifier
-> SectionsSpec a | underlying specification
-> ValueSpec a |

Named subsection value specification. The unique identifier will be used for generating a documentation section for this specification and should be unique within the scope of the specification being built.

assocSpec Source #

Arguments

:: ValueSpec a | underlying specification
-> ValueSpec [(Text, a)] |

Specification for a section list where the keys are user-defined. Values are matched against the underlying specification and returned as a list of section-name/value pairs.

Since: 0.3.0.0

## Number specifications

Specifications built from `numberSpec` matching number literals.

numberSpec :: ValueSpec Number Source #

Primitive specification for matching any number.

Since: 1.2.0.0

integerSpec :: ValueSpec Integer Source #

Specification for matching any integral number.

Since: 1.2.0.0

rationalSpec :: ValueSpec Rational Source #

Specification for matching any number as a `Rational`.

Since: 1.2.0.0

naturalSpec :: ValueSpec Natural Source #

Specification for matching any non-negative, integral number

Since: 1.2.0.0

fractionalSpec :: Fractional a => ValueSpec a Source #

Specification for matching any fractional number.

Since: 0.2.0.0

numSpec :: Num a => ValueSpec a Source #

Specification for matching any integral number.

## Text specifications

Specifications built from `textSpec` for matching string literals.

textSpec :: ValueSpec Text Source #

Specification for matching any text literal

Since: 1.2.0.0

stringSpec :: ValueSpec String Source #

Specification for matching any text as a `String`

## Atom specifications

Specifications built to match atoms.

atomSpec Source #

Arguments

:: Text | atom
-> ValueSpec () |

Primitive specification for matching a particular atom.

anyAtomSpec :: ValueSpec Text Source #

Primitive specification for matching any atom. Matched atom is returned.

yesOrNoSpec :: ValueSpec Bool Source #

Specification for using atoms `yes` and `no` to represent booleans `True` and `False` respectively

trueOrFalseSpec :: ValueSpec Bool Source #

Specification for using atoms `true` and `false` to represent booleans `True` and `False` respectively.

Since: 1.2.0.0

## List specifications

Specifications for matching list literals built with 'listSpec.

listSpec Source #

Arguments

:: ValueSpec a | element specification
-> ValueSpec [a] |

Primitive specification for matching a list of values each satisfying a given element specification.

oneOrList Source #

Arguments

:: ValueSpec a | element specification
-> ValueSpec [a] |

Specification that matches either a single element or multiple elements in a list. This can be convenient for allowing the user to avoid having to specify singleton lists in the configuration file.

nonemptySpec Source #

Arguments

:: ValueSpec a | element specification
-> ValueSpec (NonEmpty a) |

Matches a non-empty list.

Since: 0.2.0.0

oneOrNonemptySpec Source #

Arguments

:: ValueSpec a | element specification
-> ValueSpec (NonEmpty a) |

Matches a single element or a non-empty list.

Since: 0.2.0.0

# Specifying sections

Sections specifications allow you to define an unordered collection of required and optional sections using a convenient `Applicative` do-notation syntax.

Let's consider an example of a way to specify a name given a base and optional suffix.

    {-# Language OverloadedStrings, ApplicativeDo #-}
    module Example where

    import Config.Schema
    import Data.Text (Text)

    nameExample :: ValueSpec Text
    nameExample =
      sectionsSpec "name" $
      do x <- reqSection "base" "Base name"
         y <- optSection "suffix" "Optional name suffix"
         pure (maybe x (x <>) y)

Example configuration components and their extracted values.

    base:     "VAR"
    optional: "1"
    -- Generates: VAR1

Order doesn't matter

    optional: "1"
    base:     "VAR"
    -- Generates: VAR1

Optional fields can be omitted

    base:     "VAR"
    -- Generates: VAR

Unexpected sections will generate errors to help detect typos

    base:     "VAR"
    extra:    0
    -- Failure due to unexpected extra section

All required sections must appear for successful match

    optional: "1"
    -- Failure due to missing required section

data SectionsSpec a Source #

A list of section specifications used to process a whole group of key-value pairs. Multiple section specifications can be combined using this type's `Applicative` instance.

To create `SectionsSpec` values see Config.Schema.Spec

#### Instances

Instances details

Applicative SectionsSpec Source # |
Instance details Defined in Config.Schema.Types Methods pure :: a -> SectionsSpec a Source # (<*>) :: SectionsSpec (a -> b) -> SectionsSpec a -> SectionsSpec b Source # liftA2 :: (a -> b -> c) -> SectionsSpec a -> SectionsSpec b -> SectionsSpec c Source # (*>) :: SectionsSpec a -> SectionsSpec b -> SectionsSpec b Source # (<*) :: SectionsSpec a -> SectionsSpec b -> SectionsSpec a Source #
Functor SectionsSpec Source # |
Instance details Defined in Config.Schema.Types Methods fmap :: (a -> b) -> SectionsSpec a -> SectionsSpec b Source # (<$) :: a -> SectionsSpec b -> SectionsSpec a Source #

reqSection Source #

Arguments

:: HasSpec a |
=> Text | section name
-> Text | description
-> SectionsSpec a |

Specification for a required section with an implicit value specification.

optSection Source #

Arguments

:: HasSpec a |
=> Text | section name
-> Text | description
-> SectionsSpec (Maybe a) |

Specification for an optional section with an implicit value specification.

reqSection' Source #

Arguments

:: Text | section name
-> ValueSpec a | value specification
-> Text | description
-> SectionsSpec a |

Specification for a required section with an explicit value specification.

optSection' Source #

Arguments

:: Text | section name
-> ValueSpec a | value specification
-> Text | description
-> SectionsSpec (Maybe a) |

Specification for an optional section with an explicit value specification.

# Re-exports

class Functor f => Alt (f :: Type -> Type) where Source #

Laws:

    <!> is associative:             (a <!> b) <!> c = a <!> (b <!> c)
    <$> left-distributes over <!>:  f <$> (a <!> b) = (f <$> a) <!> (f <$> b)

If extended to an `Alternative` then `<!>` should equal `<|>`.

Ideally, an instance of `Alt` also satisfies the "left distribution" law of MonadPlus with respect to `<.>`:

    <.> right-distributes over <!>: (a <!> b) <.> c = (a <.> c) <!> (b <.> c)

`IO`, ``Either` a`, ``ExceptT` e m` and `STM` instead satisfy the "left catch" law:

    pure a <!> b = pure a

`Maybe` and `Identity` satisfy both "left distribution" and "left catch".

These variations cannot be stated purely in terms of the dependencies of `Alt`.

When and if MonadPlus is successfully refactored, this class should also be refactored to remove these instances.

The right distributive law should extend in the cases where the a `Bind` or `Monad` is provided to yield variations of the right distributive law:

    (m <!> n) >>- f = (m >>- f) <!> (m >>- f)
    (m <!> n) >>= f = (m >>= f) <!> (m >>= f)

Minimal complete definition

(<!>)

Methods

(<!>) :: f a -> f a -> f a infixl 3 Source #

`<|>` without a required `empty`

some :: Applicative f => f a -> f [a] Source #

many :: Applicative f => f a -> f [a] Source #

#### Instances

Instances details

Alt First |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: First a -> First a -> First a Source # some :: Applicative First => First a -> First [a] Source # many :: Applicative First => First a -> First [a] Source #
Alt Last |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Last a -> Last a -> Last a Source # some :: Applicative Last => Last a -> Last [a] Source # many :: Applicative Last => Last a -> Last [a] Source #
Alt ValueSpec Source # | Left-biased choice between two specifications
Instance details Defined in Config.Schema.Types Methods (<!>) :: ValueSpec a -> ValueSpec a -> ValueSpec a Source # some :: Applicative ValueSpec => ValueSpec a -> ValueSpec [a] Source # many :: Applicative ValueSpec => ValueSpec a -> ValueSpec [a] Source #
Alt IntMap |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: IntMap a -> IntMap a -> IntMap a Source # some :: Applicative IntMap => IntMap a -> IntMap [a] Source # many :: Applicative IntMap => IntMap a -> IntMap [a] Source #
Alt Seq |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Seq a -> Seq a -> Seq a Source # some :: Applicative Seq => Seq a -> Seq [a] Source # many :: Applicative Seq => Seq a -> Seq [a] Source #
Alt NonEmpty |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: NonEmpty a -> NonEmpty a -> NonEmpty a Source # some :: Applicative NonEmpty => NonEmpty a -> NonEmpty [a] Source # many :: Applicative NonEmpty => NonEmpty a -> NonEmpty [a] Source #
Alt Identity | Choose the first option every time. While 'choose the last option' every time is also valid, this instance satisfies more laws. Since: semigroupoids-5.3.6
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Identity a -> Identity a -> Identity a Source # some :: Applicative Identity => Identity a -> Identity [a] Source # many :: Applicative Identity => Identity a -> Identity [a] Source #
Alt First |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: First a -> First a -> First a Source # some :: Applicative First => First a -> First [a] Source # many :: Applicative First => First a -> First [a] Source #
Alt Last |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Last a -> Last a -> Last a Source # some :: Applicative Last => Last a -> Last [a] Source # many :: Applicative Last => Last a -> Last [a] Source #
Alt IO | This instance does not actually satisfy the (`<.>`) right distributive law It instead satisfies the "left catch" law
Instance details Defined in Data.Functor.Alt Methods (<!>) :: IO a -> IO a -> IO a Source # some :: Applicative IO => IO a -> IO [a] Source # many :: Applicative IO => IO a -> IO [a] Source #
Alt Maybe |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Maybe a -> Maybe a -> Maybe a Source # some :: Applicative Maybe => Maybe a -> Maybe [a] Source # many :: Applicative Maybe => Maybe a -> Maybe [a] Source #
Alt [] |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: [a] -> [a] -> [a] Source # some :: Applicative [] => [a] -> [[a]] Source # many :: Applicative [] => [a] -> [[a]] Source #
MonadPlus m => Alt (WrappedMonad m) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: WrappedMonad m a -> WrappedMonad m a -> WrappedMonad m a Source # some :: Applicative (WrappedMonad m) => WrappedMonad m a -> WrappedMonad m [a] Source # many :: Applicative (WrappedMonad m) => WrappedMonad m a -> WrappedMonad m [a] Source #
Ord k => Alt (Map k) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Map k a -> Map k a -> Map k a Source # some :: Applicative (Map k) => Map k a -> Map k [a] Source # many :: Applicative (Map k) => Map k a -> Map k [a] Source #
Alt (Alt f) |
Instance details Defined in Control.Alternative.Free Methods (<!>) :: Alt f a -> Alt f a -> Alt f a Source # some :: Applicative (Alt f) => Alt f a -> Alt f [a] Source # many :: Applicative (Alt f) => Alt f a -> Alt f [a] Source #
Alt (Alt f) |
Instance details Defined in Control.Alternative.Free.Final Methods (<!>) :: Alt f a -> Alt f a -> Alt f a Source # some :: Applicative (Alt f) => Alt f a -> Alt f [a] Source # many :: Applicative (Alt f) => Alt f a -> Alt f [a] Source #
Alt (Either a) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Either a a0 -> Either a a0 -> Either a a0 Source # some :: Applicative (Either a) => Either a a0 -> Either a [a0] Source # many :: Applicative (Either a) => Either a a0 -> Either a [a0] Source #
Alt (Proxy :: Type -> Type) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Proxy a -> Proxy a -> Proxy a Source # some :: Applicative (Proxy :: Type -> Type) => Proxy a -> Proxy [a] Source # many :: Applicative (Proxy :: Type -> Type) => Proxy a -> Proxy [a] Source #
Alt (U1 :: Type -> Type) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: U1 a -> U1 a -> U1 a Source # some :: Applicative (U1 :: Type -> Type) => U1 a -> U1 [a] Source # many :: Applicative (U1 :: Type -> Type) => U1 a -> U1 [a] Source #
Alt (V1 :: Type -> Type) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: V1 a -> V1 a -> V1 a Source # some :: Applicative (V1 :: Type -> Type) => V1 a -> V1 [a] Source # many :: Applicative (V1 :: Type -> Type) => V1 a -> V1 [a] Source #
Alt f => Alt (Coyoneda f) |
Instance details Defined in Data.Functor.Coyoneda Methods (<!>) :: Coyoneda f a -> Coyoneda f a -> Coyoneda f a Source # some :: Applicative (Coyoneda f) => Coyoneda f a -> Coyoneda f [a] Source # many :: Applicative (Coyoneda f) => Coyoneda f a -> Coyoneda f [a] Source #
Alt f => Alt (Yoneda f) |
Instance details Defined in Data.Functor.Yoneda Methods (<!>) :: Yoneda f a -> Yoneda f a -> Yoneda f a Source # some :: Applicative (Yoneda f) => Yoneda f a -> Yoneda f [a] Source # many :: Applicative (Yoneda f) => Yoneda f a -> Yoneda f [a] Source #
Alternative f => Alt (WrappedApplicative f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: WrappedApplicative f a -> WrappedApplicative f a -> WrappedApplicative f a Source # some :: Applicative (WrappedApplicative f) => WrappedApplicative f a -> WrappedApplicative f [a] Source # many :: Applicative (WrappedApplicative f) => WrappedApplicative f a -> WrappedApplicative f [a] Source #
Alt f => Alt (Lift f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Lift f a -> Lift f a -> Lift f a Source # some :: Applicative (Lift f) => Lift f a -> Lift f [a] Source # many :: Applicative (Lift f) => Lift f a -> Lift f [a] Source #
(Functor f, Monad f) => Alt (MaybeT f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: MaybeT f a -> MaybeT f a -> MaybeT f a Source # some :: Applicative (MaybeT f) => MaybeT f a -> MaybeT f [a] Source # many :: Applicative (MaybeT f) => MaybeT f a -> MaybeT f [a] Source #
(Hashable k, Eq k) => Alt (HashMap k) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: HashMap k a -> HashMap k a -> HashMap k a Source # some :: Applicative (HashMap k) => HashMap k a -> HashMap k [a] Source # many :: Applicative (HashMap k) => HashMap k a -> HashMap k [a] Source #
ArrowPlus a => Alt (WrappedArrow a b) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: WrappedArrow a b a0 -> WrappedArrow a b a0 -> WrappedArrow a b a0 Source # some :: Applicative (WrappedArrow a b) => WrappedArrow a b a0 -> WrappedArrow a b [a0] Source # many :: Applicative (WrappedArrow a b) => WrappedArrow a b a0 -> WrappedArrow a b [a0] Source #
Alt f => Alt (Rec1 f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Rec1 f a -> Rec1 f a -> Rec1 f a Source # some :: Applicative (Rec1 f) => Rec1 f a -> Rec1 f [a] Source # many :: Applicative (Rec1 f) => Rec1 f a -> Rec1 f [a] Source #
Alt f => Alt (Static f a) |
Instance details Defined in Data.Semigroupoid.Static Methods (<!>) :: Static f a a0 -> Static f a a0 -> Static f a a0 Source # some :: Applicative (Static f a) => Static f a a0 -> Static f a [a0] Source # many :: Applicative (Static f a) => Static f a a0 -> Static f a [a0] Source #
Alt f => Alt (Backwards f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Backwards f a -> Backwards f a -> Backwards f a Source # some :: Applicative (Backwards f) => Backwards f a -> Backwards f [a] Source # many :: Applicative (Backwards f) => Backwards f a -> Backwards f [a] Source #
(Functor f, Monad f, Semigroup e) => Alt (ExceptT e f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: ExceptT e f a -> ExceptT e f a -> ExceptT e f a Source # some :: Applicative (ExceptT e f) => ExceptT e f a -> ExceptT e f [a] Source # many :: Applicative (ExceptT e f) => ExceptT e f a -> ExceptT e f [a] Source #
Alt f => Alt (IdentityT f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: IdentityT f a -> IdentityT f a -> IdentityT f a Source # some :: Applicative (IdentityT f) => IdentityT f a -> IdentityT f [a] Source # many :: Applicative (IdentityT f) => IdentityT f a -> IdentityT f [a] Source #
Alt f => Alt (ReaderT e f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: ReaderT e f a -> ReaderT e f a -> ReaderT e f a Source # some :: Applicative (ReaderT e f) => ReaderT e f a -> ReaderT e f [a] Source # many :: Applicative (ReaderT e f) => ReaderT e f a -> ReaderT e f [a] Source #
Alt f => Alt (StateT e f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: StateT e f a -> StateT e f a -> StateT e f a Source # some :: Applicative (StateT e f) => StateT e f a -> StateT e f [a] Source # many :: Applicative (StateT e f) => StateT e f a -> StateT e f [a] Source #
Alt f => Alt (StateT e f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: StateT e f a -> StateT e f a -> StateT e f a Source # some :: Applicative (StateT e f) => StateT e f a -> StateT e f [a] Source # many :: Applicative (StateT e f) => StateT e f a -> StateT e f [a] Source #
Alt f => Alt (WriterT w f) | Since: semigroupoids-5.3.6
Instance details Defined in Data.Functor.Alt Methods (<!>) :: WriterT w f a -> WriterT w f a -> WriterT w f a Source # some :: Applicative (WriterT w f) => WriterT w f a -> WriterT w f [a] Source # many :: Applicative (WriterT w f) => WriterT w f a -> WriterT w f [a] Source #
Alt f => Alt (WriterT w f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: WriterT w f a -> WriterT w f a -> WriterT w f a Source # some :: Applicative (WriterT w f) => WriterT w f a -> WriterT w f [a] Source # many :: Applicative (WriterT w f) => WriterT w f a -> WriterT w f [a] Source #
Alt f => Alt (WriterT w f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: WriterT w f a -> WriterT w f a -> WriterT w f a Source # some :: Applicative (WriterT w f) => WriterT w f a -> WriterT w f [a] Source # many :: Applicative (WriterT w f) => WriterT w f a -> WriterT w f [a] Source #
Alt f => Alt (Reverse f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Reverse f a -> Reverse f a -> Reverse f a Source # some :: Applicative (Reverse f) => Reverse f a -> Reverse f [a] Source # many :: Applicative (Reverse f) => Reverse f a -> Reverse f [a] Source #
(Alt f, Alt g) => Alt (Product f g) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Product f g a -> Product f g a -> Product f g a Source # some :: Applicative (Product f g) => Product f g a -> Product f g [a] Source # many :: Applicative (Product f g) => Product f g a -> Product f g [a] Source #
(Alt f, Alt g) => Alt (f :*: g) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: (f :*: g) a -> (f :*: g) a -> (f :*: g) a Source # some :: Applicative (f :*: g) => (f :*: g) a -> (f :*: g) [a] Source # many :: Applicative (f :*: g) => (f :*: g) a -> (f :*: g) [a] Source #

Semigroup c => Alt (K1 i c :: Type -> Type)

    since 5.3.8

Instance details Defined in Data.Functor.Alt Methods (<!>) :: K1 i c a -> K1 i c a -> K1 i c a Source # some :: Applicative (K1 i c :: Type -> Type) => K1 i c a -> K1 i c [a] Source # many :: Applicative (K1 i c :: Type -> Type) => K1 i c a -> K1 i c [a] Source #
(v ~~ v', Alt v') => Alt (Codensity v) |
Instance details Defined in Control.Monad.Codensity Methods (<!>) :: Codensity v a -> Codensity v a -> Codensity v a Source # some :: Applicative (Codensity v) => Codensity v a -> Codensity v [a] Source # many :: Applicative (Codensity v) => Codensity v a -> Codensity v [a] Source #
(Alt f, Functor g) => Alt (Compose f g) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: Compose f g a -> Compose f g a -> Compose f g a Source # some :: Applicative (Compose f g) => Compose f g a -> Compose f g [a] Source # many :: Applicative (Compose f g) => Compose f g a -> Compose f g [a] Source #
(Alt f, Functor g) => Alt (f :.: g) | Since: semigroupoids-5.3.8
Instance details Defined in Data.Functor.Alt Methods (<!>) :: (f :.: g) a -> (f :.: g) a -> (f :.: g) a Source # some :: Applicative (f :.: g) => (f :.: g) a -> (f :.: g) [a] Source # many :: Applicative (f :.: g) => (f :.: g) a -> (f :.: g) [a] Source #
Alt f => Alt (M1 i c f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: M1 i c f a -> M1 i c f a -> M1 i c f a Source # some :: Applicative (M1 i c f) => M1 i c f a -> M1 i c f [a] Source # many :: Applicative (M1 i c f) => M1 i c f a -> M1 i c f [a] Source #
Alt f => Alt (RWST r w s f) | Since: semigroupoids-5.3.6
Instance details Defined in Data.Functor.Alt Methods (<!>) :: RWST r w s f a -> RWST r w s f a -> RWST r w s f a Source # some :: Applicative (RWST r w s f) => RWST r w s f a -> RWST r w s f [a] Source # many :: Applicative (RWST r w s f) => RWST r w s f a -> RWST r w s f [a] Source #
Alt f => Alt (RWST r w s f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: RWST r w s f a -> RWST r w s f a -> RWST r w s f a Source # some :: Applicative (RWST r w s f) => RWST r w s f a -> RWST r w s f [a] Source # many :: Applicative (RWST r w s f) => RWST r w s f a -> RWST r w s f [a] Source #
Alt f => Alt (RWST r w s f) |
Instance details Defined in Data.Functor.Alt Methods (<!>) :: RWST r w s f a -> RWST r w s f a -> RWST r w s f a Source # some :: Applicative (RWST r w s f) => RWST r w s f a -> RWST r w s f [a] Source # many :: Applicative (RWST r w s f) => RWST r w s f a -> RWST r w s f [a] Source #