Applicative is:module

This module describes a structure intermediate between a functor and a monad (technically, a strong lax monoidal functor). Compared with monads, this interface lacks the full power of the binding operation >>=, but
  • it has more instances.
  • it is sufficient for many uses, e.g. context-free parsing, or the Traversable class.
  • instances can perform analysis of computations before they are executed, and thus produce shared optimizations.
This interface was introduced for parsers by Niklas Röjemo, because it admits more sharing than the monadic interface. The names here are mostly based on parsing work by Doaitse Swierstra. For more details, see Applicative Programming with Effects, by Conor McBride and Ross Paterson.
This module contains reexports of Applicative and related functional. Additionally, it provides convenient combinators to work with Applicative.
TextShow instances for Const and ZipList. Since: 2
Applicative properties You will need TypeApplications to use these.
To get started, see some examples on the wiki: https://github.com/feuerbach/regex-applicative/wiki/Examples
Convenient utils to work with Applicative. There were more functions in this module (see protolude version) but only convenient ans most used are left.
Applicative properties You will need TypeApplications to use these.
Semigroups for working with Applicative Functors.
This module implements a lightweight flags parser, inspired by optparse-applicative. Sample usage (note the default log level and optional context):
module Main where

import Control.Applicative ((<|>), optional)
import Data.Text (Text)
import Flags.Applicative

-- Custom flags for our example.
data Flags = Flags
{ rootPath :: Text
, logLevel :: Int
, context :: Maybe Text
} deriving Show

-- Returns a parser from CLI arguments to our custom flags.
flagsParser :: FlagsParser Flags
flagsParser = Flags
<$> flag textVal "root" "path to the root"
<*> (flag autoVal "log_level" "" <|> pure 0)
<*> (optional $ flag textVal "context" "")

main :: IO ()
main = do
(flags, args) <- parseSystemFlagsOrDie flagsParser
print flags