graphviz-2999.20.2.0: Bindings to Graphviz for graph visualisation.
Copyright(c) Matthew Sackman Ivan Lazar Miljenovic
License3-Clause BSD-style
MaintainerIvan.Miljenovic@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.GraphViz.Parsing

Description

This module defines simple helper functions for use with Text.ParserCombinators.Poly.Lazy.

Note that the ParseDot instances for Bool, etc. match those specified for use with Graphviz (e.g. non-zero integers are equivalent to True).

You should not be using this module; rather, it is here for informative/documentative reasons. If you want to parse a DotRepr, you should use parseDotGraph rather than its ParseDot instance.

Synopsis

Re-exporting pertinent parts of Polyparse.

(<$) :: Functor f => a -> f b -> f a infixl 4 #

Replace all locations in the input with the same value. The default definition is fmap . const, but this may be overridden with a more efficient version.

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

A functor with application, providing operations to

  • embed pure expressions (pure), and
  • sequence computations and combine their results (<*> and liftA2).

A minimal complete definition must include implementations of pure and of either <*> or liftA2. If it defines both, then they must behave the same as their default definitions:

(<*>) = liftA2 id
liftA2 f x y = f <$> x <*> y

Further, any definition must satisfy the following:

Identity
pure id <*> v = v
Composition
pure (.) <*> u <*> v <*> w = u <*> (v <*> w)
Homomorphism
pure f <*> pure x = pure (f x)
Interchange
u <*> pure y = pure ($ y) <*> u

The other methods have the following default definitions, which may be overridden with equivalent specialized implementations:

As a consequence of these laws, the Functor instance for f will satisfy

It may be useful to note that supposing

forall x y. p (q x y) = f x . g y

it follows from the above that

liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v

If f is also a Monad, it should satisfy

(which implies that pure and <*> satisfy the applicative functor laws).

Minimal complete definition

pure, ((<*>) | liftA2)

Methods

pure :: a -> f a #

Lift a value.

(<*>) :: f (a -> b) -> f a -> f b infixl 4 #

Sequential application.

A few functors support an implementation of <*> that is more efficient than the default one.

Example

Expand

Used in combination with (<$>), (<*>) can be used to build a record.

>>> data MyState = MyState {arg1 :: Foo, arg2 :: Bar, arg3 :: Baz}
>>> produceFoo :: Applicative f => f Foo
>>> produceBar :: Applicative f => f Bar
>>> produceBaz :: Applicative f => f Baz
>>> mkState :: Applicative f => f MyState
>>> mkState = MyState <$> produceFoo <*> produceBar <*> produceBaz

liftA2 :: (a -> b -> c) -> f a -> f b -> f c #

Lift a binary function to actions.

Some functors support an implementation of liftA2 that is more efficient than the default one. In particular, if fmap is an expensive operation, it is likely better to use liftA2 than to fmap over the structure and then use <*>.

This became a typeclass method in 4.10.0.0. Prior to that, it was a function defined in terms of <*> and fmap.

Example

Expand
>>> liftA2 (,) (Just 3) (Just 5)
Just (3,5)

(*>) :: f a -> f b -> f b infixl 4 #

Sequence actions, discarding the value of the first argument.

Examples

Expand

If used in conjunction with the Applicative instance for Maybe, you can chain Maybe computations, with a possible "early return" in case of Nothing.

>>> Just 2 *> Just 3
Just 3
>>> Nothing *> Just 3
Nothing

Of course a more interesting use case would be to have effectful computations instead of just returning pure values.

>>> import Data.Char
>>> import Text.ParserCombinators.ReadP
>>> let p = string "my name is " *> munch1 isAlpha <* eof
>>> readP_to_S p "my name is Simon"
[("Simon","")]

(<*) :: f a -> f b -> f a infixl 4 #

Sequence actions, discarding the value of the second argument.

Instances

Instances details
Applicative ZipList
f <$> ZipList xs1 <*> ... <*> ZipList xsN
    = ZipList (zipWithN f xs1 ... xsN)

where zipWithN refers to the zipWith function of the appropriate arity (zipWith, zipWith3, zipWith4, ...). For example:

(\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..]
    = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..])
    = ZipList {getZipList = ["a5","b6b6","c7c7c7"]}

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

pure :: a -> ZipList a #

(<*>) :: ZipList (a -> b) -> ZipList a -> ZipList b #

liftA2 :: (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c #

(*>) :: ZipList a -> ZipList b -> ZipList b #

(<*) :: ZipList a -> ZipList b -> ZipList a #

Applicative Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Methods

pure :: a -> Identity a #

(<*>) :: Identity (a -> b) -> Identity a -> Identity b #

liftA2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c #

(*>) :: Identity a -> Identity b -> Identity b #

(<*) :: Identity a -> Identity b -> Identity a #

Applicative First

Since: base-4.8.0.0

Instance details

Defined in Data.Monoid

Methods

pure :: a -> First a #

(<*>) :: First (a -> b) -> First a -> First b #

liftA2 :: (a -> b -> c) -> First a -> First b -> First c #

(*>) :: First a -> First b -> First b #

(<*) :: First a -> First b -> First a #

Applicative Last

Since: base-4.8.0.0

Instance details

Defined in Data.Monoid

Methods

pure :: a -> Last a #

(<*>) :: Last (a -> b) -> Last a -> Last b #

liftA2 :: (a -> b -> c) -> Last a -> Last b -> Last c #

(*>) :: Last a -> Last b -> Last b #

(<*) :: Last a -> Last b -> Last a #

Applicative Down

Since: base-4.11.0.0

Instance details

Defined in Data.Ord

Methods

pure :: a -> Down a #

(<*>) :: Down (a -> b) -> Down a -> Down b #

liftA2 :: (a -> b -> c) -> Down a -> Down b -> Down c #

(*>) :: Down a -> Down b -> Down b #

(<*) :: Down a -> Down b -> Down a #

Applicative Dual

Since: base-4.8.0.0

Instance details

Defined in Data.Semigroup.Internal

Methods

pure :: a -> Dual a #

(<*>) :: Dual (a -> b) -> Dual a -> Dual b #

liftA2 :: (a -> b -> c) -> Dual a -> Dual b -> Dual c #

(*>) :: Dual a -> Dual b -> Dual b #

(<*) :: Dual a -> Dual b -> Dual a #

Applicative Product

Since: base-4.8.0.0

Instance details

Defined in Data.Semigroup.Internal

Methods

pure :: a -> Product a #

(<*>) :: Product (a -> b) -> Product a -> Product b #

liftA2 :: (a -> b -> c) -> Product a -> Product b -> Product c #

(*>) :: Product a -> Product b -> Product b #

(<*) :: Product a -> Product b -> Product a #

Applicative Sum

Since: base-4.8.0.0

Instance details

Defined in Data.Semigroup.Internal

Methods

pure :: a -> Sum a #

(<*>) :: Sum (a -> b) -> Sum a -> Sum b #

liftA2 :: (a -> b -> c) -> Sum a -> Sum b -> Sum c #

(*>) :: Sum a -> Sum b -> Sum b #

(<*) :: Sum a -> Sum b -> Sum a #

Applicative STM

Since: base-4.8.0.0

Instance details

Defined in GHC.Conc.Sync

Methods

pure :: a -> STM a #

(<*>) :: STM (a -> b) -> STM a -> STM b #

liftA2 :: (a -> b -> c) -> STM a -> STM b -> STM c #

(*>) :: STM a -> STM b -> STM b #

(<*) :: STM a -> STM b -> STM a #

Applicative Par1

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

pure :: a -> Par1 a #

(<*>) :: Par1 (a -> b) -> Par1 a -> Par1 b #

liftA2 :: (a -> b -> c) -> Par1 a -> Par1 b -> Par1 c #

(*>) :: Par1 a -> Par1 b -> Par1 b #

(<*) :: Par1 a -> Par1 b -> Par1 a #

Applicative P

Since: base-4.5.0.0

Instance details

Defined in Text.ParserCombinators.ReadP

Methods

pure :: a -> P a #

(<*>) :: P (a -> b) -> P a -> P b #

liftA2 :: (a -> b -> c) -> P a -> P b -> P c #

(*>) :: P a -> P b -> P b #

(<*) :: P a -> P b -> P a #

Applicative ReadP

Since: base-4.6.0.0

Instance details

Defined in Text.ParserCombinators.ReadP

Methods

pure :: a -> ReadP a #

(<*>) :: ReadP (a -> b) -> ReadP a -> ReadP b #

liftA2 :: (a -> b -> c) -> ReadP a -> ReadP b -> ReadP c #

(*>) :: ReadP a -> ReadP b -> ReadP b #

(<*) :: ReadP a -> ReadP b -> ReadP a #

Applicative ReadPrec

Since: base-4.6.0.0

Instance details

Defined in Text.ParserCombinators.ReadPrec

Methods

pure :: a -> ReadPrec a #

(<*>) :: ReadPrec (a -> b) -> ReadPrec a -> ReadPrec b #

liftA2 :: (a -> b -> c) -> ReadPrec a -> ReadPrec b -> ReadPrec c #

(*>) :: ReadPrec a -> ReadPrec b -> ReadPrec b #

(<*) :: ReadPrec a -> ReadPrec b -> ReadPrec a #

Applicative Put 
Instance details

Defined in Data.ByteString.Builder.Internal

Methods

pure :: a -> Put a #

(<*>) :: Put (a -> b) -> Put a -> Put b #

liftA2 :: (a -> b -> c) -> Put a -> Put b -> Put c #

(*>) :: Put a -> Put b -> Put b #

(<*) :: Put a -> Put b -> Put a #

Applicative RGB 
Instance details

Defined in Data.Colour.RGB

Methods

pure :: a -> RGB a #

(<*>) :: RGB (a -> b) -> RGB a -> RGB b #

liftA2 :: (a -> b -> c) -> RGB a -> RGB b -> RGB c #

(*>) :: RGB a -> RGB b -> RGB b #

(<*) :: RGB a -> RGB b -> RGB a #

Applicative Seq

Since: containers-0.5.4

Instance details

Defined in Data.Sequence.Internal

Methods

pure :: a -> Seq a #

(<*>) :: Seq (a -> b) -> Seq a -> Seq b #

liftA2 :: (a -> b -> c) -> Seq a -> Seq b -> Seq c #

(*>) :: Seq a -> Seq b -> Seq b #

(<*) :: Seq a -> Seq b -> Seq a #

Applicative Tree 
Instance details

Defined in Data.Tree

Methods

pure :: a -> Tree a #

(<*>) :: Tree (a -> b) -> Tree a -> Tree b #

liftA2 :: (a -> b -> c) -> Tree a -> Tree b -> Tree c #

(*>) :: Tree a -> Tree b -> Tree b #

(<*) :: Tree a -> Tree b -> Tree a #

Applicative DList 
Instance details

Defined in Data.DList.Internal

Methods

pure :: a -> DList a #

(<*>) :: DList (a -> b) -> DList a -> DList b #

liftA2 :: (a -> b -> c) -> DList a -> DList b -> DList c #

(*>) :: DList a -> DList b -> DList b #

(<*) :: DList a -> DList b -> DList a #

Applicative IO

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

pure :: a -> IO a #

(<*>) :: IO (a -> b) -> IO a -> IO b #

liftA2 :: (a -> b -> c) -> IO a -> IO b -> IO c #

(*>) :: IO a -> IO b -> IO b #

(<*) :: IO a -> IO b -> IO a #

Applicative DotCodeM Source # 
Instance details

Defined in Data.GraphViz.Printing

Methods

pure :: a -> DotCodeM a #

(<*>) :: DotCodeM (a -> b) -> DotCodeM a -> DotCodeM b #

liftA2 :: (a -> b -> c) -> DotCodeM a -> DotCodeM b -> DotCodeM c #

(*>) :: DotCodeM a -> DotCodeM b -> DotCodeM b #

(<*) :: DotCodeM a -> DotCodeM b -> DotCodeM a #

Applicative Q 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

pure :: a -> Q a #

(<*>) :: Q (a -> b) -> Q a -> Q b #

liftA2 :: (a -> b -> c) -> Q a -> Q b -> Q c #

(*>) :: Q a -> Q b -> Q b #

(<*) :: Q a -> Q b -> Q a #

Applicative NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

pure :: a -> NonEmpty a #

(<*>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b #

liftA2 :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c #

(*>) :: NonEmpty a -> NonEmpty b -> NonEmpty b #

(<*) :: NonEmpty a -> NonEmpty b -> NonEmpty a #

Applicative Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

pure :: a -> Maybe a #

(<*>) :: Maybe (a -> b) -> Maybe a -> Maybe b #

liftA2 :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c #

(*>) :: Maybe a -> Maybe b -> Maybe b #

(<*) :: Maybe a -> Maybe b -> Maybe a #

Applicative Solo

Since: base-4.15

Instance details

Defined in GHC.Base

Methods

pure :: a -> Solo a #

(<*>) :: Solo (a -> b) -> Solo a -> Solo b #

liftA2 :: (a -> b -> c) -> Solo a -> Solo b -> Solo c #

(*>) :: Solo a -> Solo b -> Solo b #

(<*) :: Solo a -> Solo b -> Solo a #

Applicative []

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

pure :: a -> [a] #

(<*>) :: [a -> b] -> [a] -> [b] #

liftA2 :: (a -> b -> c) -> [a] -> [b] -> [c] #

(*>) :: [a] -> [b] -> [b] #

(<*) :: [a] -> [b] -> [a] #

Monad m => Applicative (WrappedMonad m)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

pure :: a -> WrappedMonad m a #

(<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b #

liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c #

(*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b #

(<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a #

Arrow a => Applicative (ArrowMonad a)

Since: base-4.6.0.0

Instance details

Defined in Control.Arrow

Methods

pure :: a0 -> ArrowMonad a a0 #

(<*>) :: ArrowMonad a (a0 -> b) -> ArrowMonad a a0 -> ArrowMonad a b #

liftA2 :: (a0 -> b -> c) -> ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a c #

(*>) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a b #

(<*) :: ArrowMonad a a0 -> ArrowMonad a b -> ArrowMonad a a0 #

Applicative (Either e)

Since: base-3.0

Instance details

Defined in Data.Either

Methods

pure :: a -> Either e a #

(<*>) :: Either e (a -> b) -> Either e a -> Either e b #

liftA2 :: (a -> b -> c) -> Either e a -> Either e b -> Either e c #

(*>) :: Either e a -> Either e b -> Either e b #

(<*) :: Either e a -> Either e b -> Either e a #

Applicative (Proxy :: Type -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Proxy

Methods

pure :: a -> Proxy a #

(<*>) :: Proxy (a -> b) -> Proxy a -> Proxy b #

liftA2 :: (a -> b -> c) -> Proxy a -> Proxy b -> Proxy c #

(*>) :: Proxy a -> Proxy b -> Proxy b #

(<*) :: Proxy a -> Proxy b -> Proxy a #

Applicative (U1 :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

pure :: a -> U1 a #

(<*>) :: U1 (a -> b) -> U1 a -> U1 b #

liftA2 :: (a -> b -> c) -> U1 a -> U1 b -> U1 c #

(*>) :: U1 a -> U1 b -> U1 b #

(<*) :: U1 a -> U1 b -> U1 a #

Applicative (DotM n) Source # 
Instance details

Defined in Data.GraphViz.Types.Monadic

Methods

pure :: a -> DotM n a #

(<*>) :: DotM n (a -> b) -> DotM n a -> DotM n b #

liftA2 :: (a -> b -> c) -> DotM n a -> DotM n b -> DotM n c #

(*>) :: DotM n a -> DotM n b -> DotM n b #

(<*) :: DotM n a -> DotM n b -> DotM n a #

Applicative (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

Methods

pure :: a -> Parser s a #

(<*>) :: Parser s (a -> b) -> Parser s a -> Parser s b #

liftA2 :: (a -> b -> c) -> Parser s a -> Parser s b -> Parser s c #

(*>) :: Parser s a -> Parser s b -> Parser s b #

(<*) :: Parser s a -> Parser s b -> Parser s a #

Applicative (IParser t) 
Instance details

Defined in Data.Text.Internal.Read

Methods

pure :: a -> IParser t a #

(<*>) :: IParser t (a -> b) -> IParser t a -> IParser t b #

liftA2 :: (a -> b -> c) -> IParser t a -> IParser t b -> IParser t c #

(*>) :: IParser t a -> IParser t b -> IParser t b #

(<*) :: IParser t a -> IParser t b -> IParser t a #

Applicative m => Applicative (ListT m) 
Instance details

Defined in Control.Monad.Trans.List

Methods

pure :: a -> ListT m a #

(<*>) :: ListT m (a -> b) -> ListT m a -> ListT m b #

liftA2 :: (a -> b -> c) -> ListT m a -> ListT m b -> ListT m c #

(*>) :: ListT m a -> ListT m b -> ListT m b #

(<*) :: ListT m a -> ListT m b -> ListT m a #

(Functor m, Monad m) => Applicative (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

pure :: a -> MaybeT m a #

(<*>) :: MaybeT m (a -> b) -> MaybeT m a -> MaybeT m b #

liftA2 :: (a -> b -> c) -> MaybeT m a -> MaybeT m b -> MaybeT m c #

(*>) :: MaybeT m a -> MaybeT m b -> MaybeT m b #

(<*) :: MaybeT m a -> MaybeT m b -> MaybeT m a #

Monoid a => Applicative ((,) a)

For tuples, the Monoid constraint on a determines how the first values merge. For example, Strings concatenate:

("hello ", (+15)) <*> ("world!", 2002)
("hello world!",2017)

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

pure :: a0 -> (a, a0) #

(<*>) :: (a, a0 -> b) -> (a, a0) -> (a, b) #

liftA2 :: (a0 -> b -> c) -> (a, a0) -> (a, b) -> (a, c) #

(*>) :: (a, a0) -> (a, b) -> (a, b) #

(<*) :: (a, a0) -> (a, b) -> (a, a0) #

Arrow a => Applicative (WrappedArrow a b)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

pure :: a0 -> WrappedArrow a b a0 #

(<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 #

liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c #

(*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 #

(<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 #

Applicative m => Applicative (Kleisli m a)

Since: base-4.14.0.0

Instance details

Defined in Control.Arrow

Methods

pure :: a0 -> Kleisli m a a0 #

(<*>) :: Kleisli m a (a0 -> b) -> Kleisli m a a0 -> Kleisli m a b #

liftA2 :: (a0 -> b -> c) -> Kleisli m a a0 -> Kleisli m a b -> Kleisli m a c #

(*>) :: Kleisli m a a0 -> Kleisli m a b -> Kleisli m a b #

(<*) :: Kleisli m a a0 -> Kleisli m a b -> Kleisli m a a0 #

Monoid m => Applicative (Const m :: Type -> Type)

Since: base-2.0.1

Instance details

Defined in Data.Functor.Const

Methods

pure :: a -> Const m a #

(<*>) :: Const m (a -> b) -> Const m a -> Const m b #

liftA2 :: (a -> b -> c) -> Const m a -> Const m b -> Const m c #

(*>) :: Const m a -> Const m b -> Const m b #

(<*) :: Const m a -> Const m b -> Const m a #

Applicative f => Applicative (Ap f)

Since: base-4.12.0.0

Instance details

Defined in Data.Monoid

Methods

pure :: a -> Ap f a #

(<*>) :: Ap f (a -> b) -> Ap f a -> Ap f b #

liftA2 :: (a -> b -> c) -> Ap f a -> Ap f b -> Ap f c #

(*>) :: Ap f a -> Ap f b -> Ap f b #

(<*) :: Ap f a -> Ap f b -> Ap f a #

Applicative f => Applicative (Alt f)

Since: base-4.8.0.0

Instance details

Defined in Data.Semigroup.Internal

Methods

pure :: a -> Alt f a #

(<*>) :: Alt f (a -> b) -> Alt f a -> Alt f b #

liftA2 :: (a -> b -> c) -> Alt f a -> Alt f b -> Alt f c #

(*>) :: Alt f a -> Alt f b -> Alt f b #

(<*) :: Alt f a -> Alt f b -> Alt f a #

Applicative f => Applicative (Rec1 f)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

pure :: a -> Rec1 f a #

(<*>) :: Rec1 f (a -> b) -> Rec1 f a -> Rec1 f b #

liftA2 :: (a -> b -> c) -> Rec1 f a -> Rec1 f b -> Rec1 f c #

(*>) :: Rec1 f a -> Rec1 f b -> Rec1 f b #

(<*) :: Rec1 f a -> Rec1 f b -> Rec1 f a #

(Applicative f, Monad f) => Applicative (WhenMissing f x)

Equivalent to ReaderT k (ReaderT x (MaybeT f)).

Since: containers-0.5.9

Instance details

Defined in Data.IntMap.Internal

Methods

pure :: a -> WhenMissing f x a #

(<*>) :: WhenMissing f x (a -> b) -> WhenMissing f x a -> WhenMissing f x b #

liftA2 :: (a -> b -> c) -> WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x c #

(*>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b #

(<*) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x a #

(Functor m, Monad m) => Applicative (ErrorT e m) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

pure :: a -> ErrorT e m a #

(<*>) :: ErrorT e m (a -> b) -> ErrorT e m a -> ErrorT e m b #

liftA2 :: (a -> b -> c) -> ErrorT e m a -> ErrorT e m b -> ErrorT e m c #

(*>) :: ErrorT e m a -> ErrorT e m b -> ErrorT e m b #

(<*) :: ErrorT e m a -> ErrorT e m b -> ErrorT e m a #

(Functor m, Monad m) => Applicative (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

pure :: a -> ExceptT e m a #

(<*>) :: ExceptT e m (a -> b) -> ExceptT e m a -> ExceptT e m b #

liftA2 :: (a -> b -> c) -> ExceptT e m a -> ExceptT e m b -> ExceptT e m c #

(*>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b #

(<*) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m a #

Applicative m => Applicative (IdentityT m) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

pure :: a -> IdentityT m a #

(<*>) :: IdentityT m (a -> b) -> IdentityT m a -> IdentityT m b #

liftA2 :: (a -> b -> c) -> IdentityT m a -> IdentityT m b -> IdentityT m c #

(*>) :: IdentityT m a -> IdentityT m b -> IdentityT m b #

(<*) :: IdentityT m a -> IdentityT m b -> IdentityT m a #

Applicative m => Applicative (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

pure :: a -> ReaderT r m a #

(<*>) :: ReaderT r m (a -> b) -> ReaderT r m a -> ReaderT r m b #

liftA2 :: (a -> b -> c) -> ReaderT r m a -> ReaderT r m b -> ReaderT r m c #

(*>) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m b #

(<*) :: ReaderT r m a -> ReaderT r m b -> ReaderT r m a #

(Functor m, Monad m) => Applicative (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Lazy

Methods

pure :: a -> StateT s m a #

(<*>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b #

liftA2 :: (a -> b -> c) -> StateT s m a -> StateT s m b -> StateT s m c #

(*>) :: StateT s m a -> StateT s m b -> StateT s m b #

(<*) :: StateT s m a -> StateT s m b -> StateT s m a #

(Functor m, Monad m) => Applicative (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

pure :: a -> StateT s m a #

(<*>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b #

liftA2 :: (a -> b -> c) -> StateT s m a -> StateT s m b -> StateT s m c #

(*>) :: StateT s m a -> StateT s m b -> StateT s m b #

(<*) :: StateT s m a -> StateT s m b -> StateT s m a #

(Monoid w, Applicative m) => Applicative (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

pure :: a -> WriterT w m a #

(<*>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b #

liftA2 :: (a -> b -> c) -> WriterT w m a -> WriterT w m b -> WriterT w m c #

(*>) :: WriterT w m a -> WriterT w m b -> WriterT w m b #

(<*) :: WriterT w m a -> WriterT w m b -> WriterT w m a #

(Monoid w, Applicative m) => Applicative (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

pure :: a -> WriterT w m a #

(<*>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b #

liftA2 :: (a -> b -> c) -> WriterT w m a -> WriterT w m b -> WriterT w m c #

(*>) :: WriterT w m a -> WriterT w m b -> WriterT w m b #

(<*) :: WriterT w m a -> WriterT w m b -> WriterT w m a #

(Monoid a, Monoid b) => Applicative ((,,) a b)

Since: base-4.14.0.0

Instance details

Defined in GHC.Base

Methods

pure :: a0 -> (a, b, a0) #

(<*>) :: (a, b, a0 -> b0) -> (a, b, a0) -> (a, b, b0) #

liftA2 :: (a0 -> b0 -> c) -> (a, b, a0) -> (a, b, b0) -> (a, b, c) #

(*>) :: (a, b, a0) -> (a, b, b0) -> (a, b, b0) #

(<*) :: (a, b, a0) -> (a, b, b0) -> (a, b, a0) #

(Applicative f, Applicative g) => Applicative (f :*: g)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

pure :: a -> (f :*: g) a #

(<*>) :: (f :*: g) (a -> b) -> (f :*: g) a -> (f :*: g) b #

liftA2 :: (a -> b -> c) -> (f :*: g) a -> (f :*: g) b -> (f :*: g) c #

(*>) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) b #

(<*) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) a #

Monoid c => Applicative (K1 i c :: Type -> Type)

Since: base-4.12.0.0

Instance details

Defined in GHC.Generics

Methods

pure :: a -> K1 i c a #

(<*>) :: K1 i c (a -> b) -> K1 i c a -> K1 i c b #

liftA2 :: (a -> b -> c0) -> K1 i c a -> K1 i c b -> K1 i c c0 #

(*>) :: K1 i c a -> K1 i c b -> K1 i c b #

(<*) :: K1 i c a -> K1 i c b -> K1 i c a #

(Monad f, Applicative f) => Applicative (WhenMatched f x y)

Equivalent to ReaderT Key (ReaderT x (ReaderT y (MaybeT f)))

Since: containers-0.5.9

Instance details

Defined in Data.IntMap.Internal

Methods

pure :: a -> WhenMatched f x y a #

(<*>) :: WhenMatched f x y (a -> b) -> WhenMatched f x y a -> WhenMatched f x y b #

liftA2 :: (a -> b -> c) -> WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y c #

(*>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b #

(<*) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y a #

(Applicative f, Monad f) => Applicative (WhenMissing f k x)

Equivalent to ReaderT k (ReaderT x (MaybeT f)) .

Since: containers-0.5.9

Instance details

Defined in Data.Map.Internal

Methods

pure :: a -> WhenMissing f k x a #

(<*>) :: WhenMissing f k x (a -> b) -> WhenMissing f k x a -> WhenMissing f k x b #

liftA2 :: (a -> b -> c) -> WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x c #

(*>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b #

(<*) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x a #

Applicative (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

pure :: a -> ContT r m a #

(<*>) :: ContT r m (a -> b) -> ContT r m a -> ContT r m b #

liftA2 :: (a -> b -> c) -> ContT r m a -> ContT r m b -> ContT r m c #

(*>) :: ContT r m a -> ContT r m b -> ContT r m b #

(<*) :: ContT r m a -> ContT r m b -> ContT r m a #

(Monoid a, Monoid b, Monoid c) => Applicative ((,,,) a b c)

Since: base-4.14.0.0

Instance details

Defined in GHC.Base

Methods

pure :: a0 -> (a, b, c, a0) #

(<*>) :: (a, b, c, a0 -> b0) -> (a, b, c, a0) -> (a, b, c, b0) #

liftA2 :: (a0 -> b0 -> c0) -> (a, b, c, a0) -> (a, b, c, b0) -> (a, b, c, c0) #

(*>) :: (a, b, c, a0) -> (a, b, c, b0) -> (a, b, c, b0) #

(<*) :: (a, b, c, a0) -> (a, b, c, b0) -> (a, b, c, a0) #

Applicative ((->) r)

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

pure :: a -> r -> a #

(<*>) :: (r -> (a -> b)) -> (r -> a) -> r -> b #

liftA2 :: (a -> b -> c) -> (r -> a) -> (r -> b) -> r -> c #

(*>) :: (r -> a) -> (r -> b) -> r -> b #

(<*) :: (r -> a) -> (r -> b) -> r -> a #

(Applicative f, Applicative g) => Applicative (f :.: g)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

pure :: a -> (f :.: g) a #

(<*>) :: (f :.: g) (a -> b) -> (f :.: g) a -> (f :.: g) b #

liftA2 :: (a -> b -> c) -> (f :.: g) a -> (f :.: g) b -> (f :.: g) c #

(*>) :: (f :.: g) a -> (f :.: g) b -> (f :.: g) b #

(<*) :: (f :.: g) a -> (f :.: g) b -> (f :.: g) a #

Applicative f => Applicative (M1 i c f)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

pure :: a -> M1 i c f a #

(<*>) :: M1 i c f (a -> b) -> M1 i c f a -> M1 i c f b #

liftA2 :: (a -> b -> c0) -> M1 i c f a -> M1 i c f b -> M1 i c f c0 #

(*>) :: M1 i c f a -> M1 i c f b -> M1 i c f b #

(<*) :: M1 i c f a -> M1 i c f b -> M1 i c f a #

(Monad f, Applicative f) => Applicative (WhenMatched f k x y)

Equivalent to ReaderT k (ReaderT x (ReaderT y (MaybeT f)))

Since: containers-0.5.9

Instance details

Defined in Data.Map.Internal

Methods

pure :: a -> WhenMatched f k x y a #

(<*>) :: WhenMatched f k x y (a -> b) -> WhenMatched f k x y a -> WhenMatched f k x y b #

liftA2 :: (a -> b -> c) -> WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y c #

(*>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b #

(<*) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y a #

(Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Lazy

Methods

pure :: a -> RWST r w s m a #

(<*>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b #

liftA2 :: (a -> b -> c) -> RWST r w s m a -> RWST r w s m b -> RWST r w s m c #

(*>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b #

(<*) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a #

(Monoid w, Functor m, Monad m) => Applicative (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Strict

Methods

pure :: a -> RWST r w s m a #

(<*>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b #

liftA2 :: (a -> b -> c) -> RWST r w s m a -> RWST r w s m b -> RWST r w s m c #

(*>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b #

(<*) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a #

newtype ZipList a #

Lists, but with an Applicative functor based on zipping.

Constructors

ZipList 

Fields

Instances

Instances details
Foldable ZipList

Since: base-4.9.0.0

Instance details

Defined in Control.Applicative

Methods

fold :: Monoid m => ZipList m -> m #

foldMap :: Monoid m => (a -> m) -> ZipList a -> m #

foldMap' :: Monoid m => (a -> m) -> ZipList a -> m #

foldr :: (a -> b -> b) -> b -> ZipList a -> b #

foldr' :: (a -> b -> b) -> b -> ZipList a -> b #

foldl :: (b -> a -> b) -> b -> ZipList a -> b #

foldl' :: (b -> a -> b) -> b -> ZipList a -> b #

foldr1 :: (a -> a -> a) -> ZipList a -> a #

foldl1 :: (a -> a -> a) -> ZipList a -> a #

toList :: ZipList a -> [a] #

null :: ZipList a -> Bool #

length :: ZipList a -> Int #

elem :: Eq a => a -> ZipList a -> Bool #

maximum :: Ord a => ZipList a -> a #

minimum :: Ord a => ZipList a -> a #

sum :: Num a => ZipList a -> a #

product :: Num a => ZipList a -> a #

Traversable ZipList

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> ZipList a -> f (ZipList b) #

sequenceA :: Applicative f => ZipList (f a) -> f (ZipList a) #

mapM :: Monad m => (a -> m b) -> ZipList a -> m (ZipList b) #

sequence :: Monad m => ZipList (m a) -> m (ZipList a) #

Alternative ZipList

Since: base-4.11.0.0

Instance details

Defined in Control.Applicative

Methods

empty :: ZipList a #

(<|>) :: ZipList a -> ZipList a -> ZipList a #

some :: ZipList a -> ZipList [a] #

many :: ZipList a -> ZipList [a] #

Applicative ZipList
f <$> ZipList xs1 <*> ... <*> ZipList xsN
    = ZipList (zipWithN f xs1 ... xsN)

where zipWithN refers to the zipWith function of the appropriate arity (zipWith, zipWith3, zipWith4, ...). For example:

(\a b c -> stimes c [a, b]) <$> ZipList "abcd" <*> ZipList "567" <*> ZipList [1..]
    = ZipList (zipWith3 (\a b c -> stimes c [a, b]) "abcd" "567" [1..])
    = ZipList {getZipList = ["a5","b6b6","c7c7c7"]}

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

pure :: a -> ZipList a #

(<*>) :: ZipList (a -> b) -> ZipList a -> ZipList b #

liftA2 :: (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c #

(*>) :: ZipList a -> ZipList b -> ZipList b #

(<*) :: ZipList a -> ZipList b -> ZipList a #

Functor ZipList

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

fmap :: (a -> b) -> ZipList a -> ZipList b #

(<$) :: a -> ZipList b -> ZipList a #

Generic1 ZipList 
Instance details

Defined in Control.Applicative

Associated Types

type Rep1 ZipList :: k -> Type #

Methods

from1 :: forall (a :: k). ZipList a -> Rep1 ZipList a #

to1 :: forall (a :: k). Rep1 ZipList a -> ZipList a #

IsList (ZipList a)

Since: base-4.15.0.0

Instance details

Defined in GHC.Exts

Associated Types

type Item (ZipList a) #

Methods

fromList :: [Item (ZipList a)] -> ZipList a #

fromListN :: Int -> [Item (ZipList a)] -> ZipList a #

toList :: ZipList a -> [Item (ZipList a)] #

Generic (ZipList a) 
Instance details

Defined in Control.Applicative

Associated Types

type Rep (ZipList a) :: Type -> Type #

Methods

from :: ZipList a -> Rep (ZipList a) x #

to :: Rep (ZipList a) x -> ZipList a #

Read a => Read (ZipList a)

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

Show a => Show (ZipList a)

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

Methods

showsPrec :: Int -> ZipList a -> ShowS #

show :: ZipList a -> String #

showList :: [ZipList a] -> ShowS #

Eq a => Eq (ZipList a)

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

Methods

(==) :: ZipList a -> ZipList a -> Bool #

(/=) :: ZipList a -> ZipList a -> Bool #

Ord a => Ord (ZipList a)

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

Methods

compare :: ZipList a -> ZipList a -> Ordering #

(<) :: ZipList a -> ZipList a -> Bool #

(<=) :: ZipList a -> ZipList a -> Bool #

(>) :: ZipList a -> ZipList a -> Bool #

(>=) :: ZipList a -> ZipList a -> Bool #

max :: ZipList a -> ZipList a -> ZipList a #

min :: ZipList a -> ZipList a -> ZipList a #

type Rep1 ZipList

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

type Rep1 ZipList = D1 ('MetaData "ZipList" "Control.Applicative" "base" 'True) (C1 ('MetaCons "ZipList" 'PrefixI 'True) (S1 ('MetaSel ('Just "getZipList") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 [])))
type Item (ZipList a) 
Instance details

Defined in GHC.Exts

type Item (ZipList a) = a
type Rep (ZipList a)

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

type Rep (ZipList a) = D1 ('MetaData "ZipList" "Control.Applicative" "base" 'True) (C1 ('MetaCons "ZipList" 'PrefixI 'True) (S1 ('MetaSel ('Just "getZipList") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a])))

newtype WrappedMonad (m :: Type -> Type) a #

Constructors

WrapMonad 

Fields

Instances

Instances details
Generic1 (WrappedMonad m :: Type -> Type) 
Instance details

Defined in Control.Applicative

Associated Types

type Rep1 (WrappedMonad m) :: k -> Type #

Methods

from1 :: forall (a :: k). WrappedMonad m a -> Rep1 (WrappedMonad m) a #

to1 :: forall (a :: k). Rep1 (WrappedMonad m) a -> WrappedMonad m a #

MonadPlus m => Alternative (WrappedMonad m)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

empty :: WrappedMonad m a #

(<|>) :: WrappedMonad m a -> WrappedMonad m a -> WrappedMonad m a #

some :: WrappedMonad m a -> WrappedMonad m [a] #

many :: WrappedMonad m a -> WrappedMonad m [a] #

Monad m => Applicative (WrappedMonad m)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

pure :: a -> WrappedMonad m a #

(<*>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b #

liftA2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c #

(*>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b #

(<*) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a #

Monad m => Functor (WrappedMonad m)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

fmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b #

(<$) :: a -> WrappedMonad m b -> WrappedMonad m a #

Monad m => Monad (WrappedMonad m)

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

Methods

(>>=) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b #

(>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b #

return :: a -> WrappedMonad m a #

Generic (WrappedMonad m a) 
Instance details

Defined in Control.Applicative

Associated Types

type Rep (WrappedMonad m a) :: Type -> Type #

Methods

from :: WrappedMonad m a -> Rep (WrappedMonad m a) x #

to :: Rep (WrappedMonad m a) x -> WrappedMonad m a #

type Rep1 (WrappedMonad m :: Type -> Type)

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

type Rep1 (WrappedMonad m :: Type -> Type) = D1 ('MetaData "WrappedMonad" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapMonad" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapMonad") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 m)))
type Rep (WrappedMonad m a)

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

type Rep (WrappedMonad m a) = D1 ('MetaData "WrappedMonad" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapMonad" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapMonad") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (m a))))

newtype WrappedArrow (a :: Type -> Type -> Type) b c #

Constructors

WrapArrow 

Fields

Instances

Instances details
Generic1 (WrappedArrow a b :: Type -> Type) 
Instance details

Defined in Control.Applicative

Associated Types

type Rep1 (WrappedArrow a b) :: k -> Type #

Methods

from1 :: forall (a0 :: k). WrappedArrow a b a0 -> Rep1 (WrappedArrow a b) a0 #

to1 :: forall (a0 :: k). Rep1 (WrappedArrow a b) a0 -> WrappedArrow a b a0 #

(ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

empty :: WrappedArrow a b a0 #

(<|>) :: WrappedArrow a b a0 -> WrappedArrow a b a0 -> WrappedArrow a b a0 #

some :: WrappedArrow a b a0 -> WrappedArrow a b [a0] #

many :: WrappedArrow a b a0 -> WrappedArrow a b [a0] #

Arrow a => Applicative (WrappedArrow a b)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

pure :: a0 -> WrappedArrow a b a0 #

(<*>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 #

liftA2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c #

(*>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 #

(<*) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 #

Arrow a => Functor (WrappedArrow a b)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

fmap :: (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 #

(<$) :: a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 #

Generic (WrappedArrow a b c) 
Instance details

Defined in Control.Applicative

Associated Types

type Rep (WrappedArrow a b c) :: Type -> Type #

Methods

from :: WrappedArrow a b c -> Rep (WrappedArrow a b c) x #

to :: Rep (WrappedArrow a b c) x -> WrappedArrow a b c #

type Rep1 (WrappedArrow a b :: Type -> Type)

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

type Rep1 (WrappedArrow a b :: Type -> Type) = D1 ('MetaData "WrappedArrow" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapArrow" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapArrow") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 (a b))))
type Rep (WrappedArrow a b c)

Since: base-4.7.0.0

Instance details

Defined in Control.Applicative

type Rep (WrappedArrow a b c) = D1 ('MetaData "WrappedArrow" "Control.Applicative" "base" 'True) (C1 ('MetaCons "WrapArrow" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapArrow") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a b c))))

optional :: Alternative f => f a -> f (Maybe a) #

One or none.

It is useful for modelling any computation that is allowed to fail.

Examples

Expand

Using the Alternative instance of Control.Monad.Except, the following functions:

>>> import Control.Monad.Except
>>> canFail = throwError "it failed" :: Except String Int
>>> final = return 42                :: Except String Int

Can be combined by allowing the first function to fail:

>>> runExcept $ canFail *> final
Left "it failed"
>>> runExcept $ optional canFail *> final
Right 42

newtype Const a (b :: k) #

The Const functor.

Constructors

Const 

Fields

Instances

Instances details
Generic1 (Const a :: k -> Type) 
Instance details

Defined in Data.Functor.Const

Associated Types

type Rep1 (Const a) :: k -> Type #

Methods

from1 :: forall (a0 :: k0). Const a a0 -> Rep1 (Const a) a0 #

to1 :: forall (a0 :: k0). Rep1 (Const a) a0 -> Const a a0 #

Eq2 (Const :: Type -> Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> Const a c -> Const b d -> Bool #

Ord2 (Const :: Type -> Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> Const a c -> Const b d -> Ordering #

Read2 (Const :: Type -> Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Const a b) #

liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Const a b] #

liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Const a b) #

liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Const a b] #

Show2 (Const :: Type -> TYPE LiftedRep -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> Const a b -> ShowS #

liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [Const a b] -> ShowS #

Foldable (Const m :: TYPE LiftedRep -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Functor.Const

Methods

fold :: Monoid m0 => Const m m0 -> m0 #

foldMap :: Monoid m0 => (a -> m0) -> Const m a -> m0 #

foldMap' :: Monoid m0 => (a -> m0) -> Const m a -> m0 #

foldr :: (a -> b -> b) -> b -> Const m a -> b #

foldr' :: (a -> b -> b) -> b -> Const m a -> b #

foldl :: (b -> a -> b) -> b -> Const m a -> b #

foldl' :: (b -> a -> b) -> b -> Const m a -> b #

foldr1 :: (a -> a -> a) -> Const m a -> a #

foldl1 :: (a -> a -> a) -> Const m a -> a #

toList :: Const m a -> [a] #

null :: Const m a -> Bool #

length :: Const m a -> Int #

elem :: Eq a => a -> Const m a -> Bool #

maximum :: Ord a => Const m a -> a #

minimum :: Ord a => Const m a -> a #

sum :: Num a => Const m a -> a #

product :: Num a => Const m a -> a #

Eq a => Eq1 (Const a :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a0 -> b -> Bool) -> Const a a0 -> Const a b -> Bool #

Ord a => Ord1 (Const a :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a0 -> b -> Ordering) -> Const a a0 -> Const a b -> Ordering #

Read a => Read1 (Const a :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (Const a a0) #

liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [Const a a0] #

liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (Const a a0) #

liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [Const a a0] #

Show a => Show1 (Const a :: TYPE LiftedRep -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> Const a a0 -> ShowS #

liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [Const a a0] -> ShowS #

Traversable (Const m :: Type -> Type)

Since: base-4.7.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> Const m a -> f (Const m b) #

sequenceA :: Applicative f => Const m (f a) -> f (Const m a) #

mapM :: Monad m0 => (a -> m0 b) -> Const m a -> m0 (Const m b) #

sequence :: Monad m0 => Const m (m0 a) -> m0 (Const m a) #

Monoid m => Applicative (Const m :: Type -> Type)

Since: base-2.0.1

Instance details

Defined in Data.Functor.Const

Methods

pure :: a -> Const m a #

(<*>) :: Const m (a -> b) -> Const m a -> Const m b #

liftA2 :: (a -> b -> c) -> Const m a -> Const m b -> Const m c #

(*>) :: Const m a -> Const m b -> Const m b #

(<*) :: Const m a -> Const m b -> Const m a #

Functor (Const m :: Type -> Type)

Since: base-2.1

Instance details

Defined in Data.Functor.Const

Methods

fmap :: (a -> b) -> Const m a -> Const m b #

(<$) :: a -> Const m b -> Const m a #

IsString a => IsString (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.String

Methods

fromString :: String -> Const a b #

Storable a => Storable (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

sizeOf :: Const a b -> Int #

alignment :: Const a b -> Int #

peekElemOff :: Ptr (Const a b) -> Int -> IO (Const a b) #

pokeElemOff :: Ptr (Const a b) -> Int -> Const a b -> IO () #

peekByteOff :: Ptr b0 -> Int -> IO (Const a b) #

pokeByteOff :: Ptr b0 -> Int -> Const a b -> IO () #

peek :: Ptr (Const a b) -> IO (Const a b) #

poke :: Ptr (Const a b) -> Const a b -> IO () #

Monoid a => Monoid (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

mempty :: Const a b #

mappend :: Const a b -> Const a b -> Const a b #

mconcat :: [Const a b] -> Const a b #

Semigroup a => Semigroup (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(<>) :: Const a b -> Const a b -> Const a b #

sconcat :: NonEmpty (Const a b) -> Const a b #

stimes :: Integral b0 => b0 -> Const a b -> Const a b #

Bits a => Bits (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(.&.) :: Const a b -> Const a b -> Const a b #

(.|.) :: Const a b -> Const a b -> Const a b #

xor :: Const a b -> Const a b -> Const a b #

complement :: Const a b -> Const a b #

shift :: Const a b -> Int -> Const a b #

rotate :: Const a b -> Int -> Const a b #

zeroBits :: Const a b #

bit :: Int -> Const a b #

setBit :: Const a b -> Int -> Const a b #

clearBit :: Const a b -> Int -> Const a b #

complementBit :: Const a b -> Int -> Const a b #

testBit :: Const a b -> Int -> Bool #

bitSizeMaybe :: Const a b -> Maybe Int #

bitSize :: Const a b -> Int #

isSigned :: Const a b -> Bool #

shiftL :: Const a b -> Int -> Const a b #

unsafeShiftL :: Const a b -> Int -> Const a b #

shiftR :: Const a b -> Int -> Const a b #

unsafeShiftR :: Const a b -> Int -> Const a b #

rotateL :: Const a b -> Int -> Const a b #

rotateR :: Const a b -> Int -> Const a b #

popCount :: Const a b -> Int #

FiniteBits a => FiniteBits (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Bounded a => Bounded (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

minBound :: Const a b #

maxBound :: Const a b #

Enum a => Enum (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

succ :: Const a b -> Const a b #

pred :: Const a b -> Const a b #

toEnum :: Int -> Const a b #

fromEnum :: Const a b -> Int #

enumFrom :: Const a b -> [Const a b] #

enumFromThen :: Const a b -> Const a b -> [Const a b] #

enumFromTo :: Const a b -> Const a b -> [Const a b] #

enumFromThenTo :: Const a b -> Const a b -> Const a b -> [Const a b] #

Floating a => Floating (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

pi :: Const a b #

exp :: Const a b -> Const a b #

log :: Const a b -> Const a b #

sqrt :: Const a b -> Const a b #

(**) :: Const a b -> Const a b -> Const a b #

logBase :: Const a b -> Const a b -> Const a b #

sin :: Const a b -> Const a b #

cos :: Const a b -> Const a b #

tan :: Const a b -> Const a b #

asin :: Const a b -> Const a b #

acos :: Const a b -> Const a b #

atan :: Const a b -> Const a b #

sinh :: Const a b -> Const a b #

cosh :: Const a b -> Const a b #

tanh :: Const a b -> Const a b #

asinh :: Const a b -> Const a b #

acosh :: Const a b -> Const a b #

atanh :: Const a b -> Const a b #

log1p :: Const a b -> Const a b #

expm1 :: Const a b -> Const a b #

log1pexp :: Const a b -> Const a b #

log1mexp :: Const a b -> Const a b #

RealFloat a => RealFloat (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

floatRadix :: Const a b -> Integer #

floatDigits :: Const a b -> Int #

floatRange :: Const a b -> (Int, Int) #

decodeFloat :: Const a b -> (Integer, Int) #

encodeFloat :: Integer -> Int -> Const a b #

exponent :: Const a b -> Int #

significand :: Const a b -> Const a b #

scaleFloat :: Int -> Const a b -> Const a b #

isNaN :: Const a b -> Bool #

isInfinite :: Const a b -> Bool #

isDenormalized :: Const a b -> Bool #

isNegativeZero :: Const a b -> Bool #

isIEEE :: Const a b -> Bool #

atan2 :: Const a b -> Const a b -> Const a b #

Generic (Const a b) 
Instance details

Defined in Data.Functor.Const

Associated Types

type Rep (Const a b) :: Type -> Type #

Methods

from :: Const a b -> Rep (Const a b) x #

to :: Rep (Const a b) x -> Const a b #

Ix a => Ix (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

range :: (Const a b, Const a b) -> [Const a b] #

index :: (Const a b, Const a b) -> Const a b -> Int #

unsafeIndex :: (Const a b, Const a b) -> Const a b -> Int #

inRange :: (Const a b, Const a b) -> Const a b -> Bool #

rangeSize :: (Const a b, Const a b) -> Int #

unsafeRangeSize :: (Const a b, Const a b) -> Int #

Num a => Num (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(+) :: Const a b -> Const a b -> Const a b #

(-) :: Const a b -> Const a b -> Const a b #

(*) :: Const a b -> Const a b -> Const a b #

negate :: Const a b -> Const a b #

abs :: Const a b -> Const a b #

signum :: Const a b -> Const a b #

fromInteger :: Integer -> Const a b #

Read a => Read (Const a b)

This instance would be equivalent to the derived instances of the Const newtype if the getConst field were removed

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Const

Fractional a => Fractional (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(/) :: Const a b -> Const a b -> Const a b #

recip :: Const a b -> Const a b #

fromRational :: Rational -> Const a b #

Integral a => Integral (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

quot :: Const a b -> Const a b -> Const a b #

rem :: Const a b -> Const a b -> Const a b #

div :: Const a b -> Const a b -> Const a b #

mod :: Const a b -> Const a b -> Const a b #

quotRem :: Const a b -> Const a b -> (Const a b, Const a b) #

divMod :: Const a b -> Const a b -> (Const a b, Const a b) #

toInteger :: Const a b -> Integer #

Real a => Real (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

toRational :: Const a b -> Rational #

RealFrac a => RealFrac (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

properFraction :: Integral b0 => Const a b -> (b0, Const a b) #

truncate :: Integral b0 => Const a b -> b0 #

round :: Integral b0 => Const a b -> b0 #

ceiling :: Integral b0 => Const a b -> b0 #

floor :: Integral b0 => Const a b -> b0 #

Show a => Show (Const a b)

This instance would be equivalent to the derived instances of the Const newtype if the getConst field were removed

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Const

Methods

showsPrec :: Int -> Const a b -> ShowS #

show :: Const a b -> String #

showList :: [Const a b] -> ShowS #

Eq a => Eq (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

(==) :: Const a b -> Const a b -> Bool #

(/=) :: Const a b -> Const a b -> Bool #

Ord a => Ord (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

Methods

compare :: Const a b -> Const a b -> Ordering #

(<) :: Const a b -> Const a b -> Bool #

(<=) :: Const a b -> Const a b -> Bool #

(>) :: Const a b -> Const a b -> Bool #

(>=) :: Const a b -> Const a b -> Bool #

max :: Const a b -> Const a b -> Const a b #

min :: Const a b -> Const a b -> Const a b #

type Rep1 (Const a :: k -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

type Rep1 (Const a :: k -> Type) = D1 ('MetaData "Const" "Data.Functor.Const" "base" 'True) (C1 ('MetaCons "Const" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))
type Rep (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Const

type Rep (Const a b) = D1 ('MetaData "Const" "Data.Functor.Const" "base" 'True) (C1 ('MetaCons "Const" 'PrefixI 'True) (S1 ('MetaSel ('Just "getConst") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))

asum :: (Foldable t, Alternative f) => t (f a) -> f a #

The sum of a collection of actions, generalizing concat.

asum is just like msum, but generalised to Alternative.

Examples

Expand

Basic usage:

>>> asum [Just "Hello", Nothing, Just "World"]
Just "Hello"

(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 #

An infix synonym for fmap.

The name of this operator is an allusion to $. Note the similarities between their types:

 ($)  ::              (a -> b) ->   a ->   b
(<$>) :: Functor f => (a -> b) -> f a -> f b

Whereas $ is function application, <$> is function application lifted over a Functor.

Examples

Expand

Convert from a Maybe Int to a Maybe String using show:

>>> show <$> Nothing
Nothing
>>> show <$> Just 3
Just "3"

Convert from an Either Int Int to an Either Int String using show:

>>> show <$> Left 17
Left 17
>>> show <$> Right 17
Right "17"

Double each element of a list:

>>> (*2) <$> [1,2,3]
[2,4,6]

Apply even to the second element of a pair:

>>> even <$> (2,2)
(2,True)

class Applicative f => Alternative (f :: Type -> Type) where #

A monoid on applicative functors.

If defined, some and many should be the least solutions of the equations:

Minimal complete definition

empty, (<|>)

Methods

(<|>) :: f a -> f a -> f a infixl 3 #

An associative binary operation

some :: f a -> f [a] #

One or more.

many :: f a -> f [a] #

Zero or more.

Instances

Instances details
Alternative ZipList

Since: base-4.11.0.0

Instance details

Defined in Control.Applicative

Methods

empty :: ZipList a #

(<|>) :: ZipList a -> ZipList a -> ZipList a #

some :: ZipList a -> ZipList [a] #

many :: ZipList a -> ZipList [a] #

Alternative STM

Since: base-4.8.0.0

Instance details

Defined in GHC.Conc.Sync

Methods

empty :: STM a #

(<|>) :: STM a -> STM a -> STM a #

some :: STM a -> STM [a] #

many :: STM a -> STM [a] #

Alternative P

Since: base-4.5.0.0

Instance details

Defined in Text.ParserCombinators.ReadP

Methods

empty :: P a #

(<|>) :: P a -> P a -> P a #

some :: P a -> P [a] #

many :: P a -> P [a] #

Alternative ReadP

Since: base-4.6.0.0

Instance details

Defined in Text.ParserCombinators.ReadP

Methods

empty :: ReadP a #

(<|>) :: ReadP a -> ReadP a -> ReadP a #

some :: ReadP a -> ReadP [a] #

many :: ReadP a -> ReadP [a] #

Alternative ReadPrec

Since: base-4.6.0.0

Instance details

Defined in Text.ParserCombinators.ReadPrec

Methods

empty :: ReadPrec a #

(<|>) :: ReadPrec a -> ReadPrec a -> ReadPrec a #

some :: ReadPrec a -> ReadPrec [a] #

many :: ReadPrec a -> ReadPrec [a] #

Alternative Seq

Since: containers-0.5.4

Instance details

Defined in Data.Sequence.Internal

Methods

empty :: Seq a #

(<|>) :: Seq a -> Seq a -> Seq a #

some :: Seq a -> Seq [a] #

many :: Seq a -> Seq [a] #

Alternative DList 
Instance details

Defined in Data.DList.Internal

Methods

empty :: DList a #

(<|>) :: DList a -> DList a -> DList a #

some :: DList a -> DList [a] #

many :: DList a -> DList [a] #

Alternative IO

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

empty :: IO a #

(<|>) :: IO a -> IO a -> IO a #

some :: IO a -> IO [a] #

many :: IO a -> IO [a] #

Alternative Maybe

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

empty :: Maybe a #

(<|>) :: Maybe a -> Maybe a -> Maybe a #

some :: Maybe a -> Maybe [a] #

many :: Maybe a -> Maybe [a] #

Alternative []

Since: base-2.1

Instance details

Defined in GHC.Base

Methods

empty :: [a] #

(<|>) :: [a] -> [a] -> [a] #

some :: [a] -> [[a]] #

many :: [a] -> [[a]] #

MonadPlus m => Alternative (WrappedMonad m)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

empty :: WrappedMonad m a #

(<|>) :: WrappedMonad m a -> WrappedMonad m a -> WrappedMonad m a #

some :: WrappedMonad m a -> WrappedMonad m [a] #

many :: WrappedMonad m a -> WrappedMonad m [a] #

ArrowPlus a => Alternative (ArrowMonad a)

Since: base-4.6.0.0

Instance details

Defined in Control.Arrow

Methods

empty :: ArrowMonad a a0 #

(<|>) :: ArrowMonad a a0 -> ArrowMonad a a0 -> ArrowMonad a a0 #

some :: ArrowMonad a a0 -> ArrowMonad a [a0] #

many :: ArrowMonad a a0 -> ArrowMonad a [a0] #

Alternative (Proxy :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in Data.Proxy

Methods

empty :: Proxy a #

(<|>) :: Proxy a -> Proxy a -> Proxy a #

some :: Proxy a -> Proxy [a] #

many :: Proxy a -> Proxy [a] #

Alternative (U1 :: Type -> Type)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

empty :: U1 a #

(<|>) :: U1 a -> U1 a -> U1 a #

some :: U1 a -> U1 [a] #

many :: U1 a -> U1 [a] #

Alternative (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

Methods

empty :: Parser s a #

(<|>) :: Parser s a -> Parser s a -> Parser s a #

some :: Parser s a -> Parser s [a] #

many :: Parser s a -> Parser s [a] #

Applicative m => Alternative (ListT m) 
Instance details

Defined in Control.Monad.Trans.List

Methods

empty :: ListT m a #

(<|>) :: ListT m a -> ListT m a -> ListT m a #

some :: ListT m a -> ListT m [a] #

many :: ListT m a -> ListT m [a] #

(Functor m, Monad m) => Alternative (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

empty :: MaybeT m a #

(<|>) :: MaybeT m a -> MaybeT m a -> MaybeT m a #

some :: MaybeT m a -> MaybeT m [a] #

many :: MaybeT m a -> MaybeT m [a] #

(ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b)

Since: base-2.1

Instance details

Defined in Control.Applicative

Methods

empty :: WrappedArrow a b a0 #

(<|>) :: WrappedArrow a b a0 -> WrappedArrow a b a0 -> WrappedArrow a b a0 #

some :: WrappedArrow a b a0 -> WrappedArrow a b [a0] #

many :: WrappedArrow a b a0 -> WrappedArrow a b [a0] #

Alternative m => Alternative (Kleisli m a)

Since: base-4.14.0.0

Instance details

Defined in Control.Arrow

Methods

empty :: Kleisli m a a0 #

(<|>) :: Kleisli m a a0 -> Kleisli m a a0 -> Kleisli m a a0 #

some :: Kleisli m a a0 -> Kleisli m a [a0] #

many :: Kleisli m a a0 -> Kleisli m a [a0] #

Alternative f => Alternative (Ap f)

Since: base-4.12.0.0

Instance details

Defined in Data.Monoid

Methods

empty :: Ap f a #

(<|>) :: Ap f a -> Ap f a -> Ap f a #

some :: Ap f a -> Ap f [a] #

many :: Ap f a -> Ap f [a] #

Alternative f => Alternative (Alt f)

Since: base-4.8.0.0

Instance details

Defined in Data.Semigroup.Internal

Methods

empty :: Alt f a #

(<|>) :: Alt f a -> Alt f a -> Alt f a #

some :: Alt f a -> Alt f [a] #

many :: Alt f a -> Alt f [a] #

Alternative f => Alternative (Rec1 f)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

empty :: Rec1 f a #

(<|>) :: Rec1 f a -> Rec1 f a -> Rec1 f a #

some :: Rec1 f a -> Rec1 f [a] #

many :: Rec1 f a -> Rec1 f [a] #

(Functor m, Monad m, Error e) => Alternative (ErrorT e m) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

empty :: ErrorT e m a #

(<|>) :: ErrorT e m a -> ErrorT e m a -> ErrorT e m a #

some :: ErrorT e m a -> ErrorT e m [a] #

many :: ErrorT e m a -> ErrorT e m [a] #

(Functor m, Monad m, Monoid e) => Alternative (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

empty :: ExceptT e m a #

(<|>) :: ExceptT e m a -> ExceptT e m a -> ExceptT e m a #

some :: ExceptT e m a -> ExceptT e m [a] #

many :: ExceptT e m a -> ExceptT e m [a] #

Alternative m => Alternative (IdentityT m) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

empty :: IdentityT m a #

(<|>) :: IdentityT m a -> IdentityT m a -> IdentityT m a #

some :: IdentityT m a -> IdentityT m [a] #

many :: IdentityT m a -> IdentityT m [a] #

Alternative m => Alternative (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

empty :: ReaderT r m a #

(<|>) :: ReaderT r m a -> ReaderT r m a -> ReaderT r m a #

some :: ReaderT r m a -> ReaderT r m [a] #

many :: ReaderT r m a -> ReaderT r m [a] #

(Functor m, MonadPlus m) => Alternative (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Lazy

Methods

empty :: StateT s m a #

(<|>) :: StateT s m a -> StateT s m a -> StateT s m a #

some :: StateT s m a -> StateT s m [a] #

many :: StateT s m a -> StateT s m [a] #

(Functor m, MonadPlus m) => Alternative (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

empty :: StateT s m a #

(<|>) :: StateT s m a -> StateT s m a -> StateT s m a #

some :: StateT s m a -> StateT s m [a] #

many :: StateT s m a -> StateT s m [a] #

(Monoid w, Alternative m) => Alternative (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

empty :: WriterT w m a #

(<|>) :: WriterT w m a -> WriterT w m a -> WriterT w m a #

some :: WriterT w m a -> WriterT w m [a] #

many :: WriterT w m a -> WriterT w m [a] #

(Monoid w, Alternative m) => Alternative (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

empty :: WriterT w m a #

(<|>) :: WriterT w m a -> WriterT w m a -> WriterT w m a #

some :: WriterT w m a -> WriterT w m [a] #

many :: WriterT w m a -> WriterT w m [a] #

(Alternative f, Alternative g) => Alternative (f :*: g)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

empty :: (f :*: g) a #

(<|>) :: (f :*: g) a -> (f :*: g) a -> (f :*: g) a #

some :: (f :*: g) a -> (f :*: g) [a] #

many :: (f :*: g) a -> (f :*: g) [a] #

(Alternative f, Applicative g) => Alternative (f :.: g)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

empty :: (f :.: g) a #

(<|>) :: (f :.: g) a -> (f :.: g) a -> (f :.: g) a #

some :: (f :.: g) a -> (f :.: g) [a] #

many :: (f :.: g) a -> (f :.: g) [a] #

Alternative f => Alternative (M1 i c f)

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

empty :: M1 i c f a #

(<|>) :: M1 i c f a -> M1 i c f a -> M1 i c f a #

some :: M1 i c f a -> M1 i c f [a] #

many :: M1 i c f a -> M1 i c f [a] #

(Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Lazy

Methods

empty :: RWST r w s m a #

(<|>) :: RWST r w s m a -> RWST r w s m a -> RWST r w s m a #

some :: RWST r w s m a -> RWST r w s m [a] #

many :: RWST r w s m a -> RWST r w s m [a] #

(Monoid w, Functor m, MonadPlus m) => Alternative (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Strict

Methods

empty :: RWST r w s m a #

(<|>) :: RWST r w s m a -> RWST r w s m a -> RWST r w s m a #

some :: RWST r w s m a -> RWST r w s m [a] #

many :: RWST r w s m a -> RWST r w s m [a] #

liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d #

Lift a ternary function to actions.

liftA :: Applicative f => (a -> b) -> f a -> f b #

Lift a function to actions. Equivalent to Functor's fmap but implemented using only Applicative's methods: `liftA f a = pure f * a`

As such this function may be used to implement a Functor instance from an Applicative one.

(<**>) :: Applicative f => f a -> f (a -> b) -> f b infixl 4 #

A variant of <*> with the arguments reversed.

reparse :: Text -> Parser s () #

Push some tokens back onto the front of the input stream and reparse. This is useful e.g. for recursively expanding macros. When the user-parser recognises a macro use, it can lookup the macro expansion from the parse state, lex it, and then stuff the lexed expansion back down into the parser.

stGet :: Parser s s #

Deliver the entire internal state.

stQuery :: (s -> a) -> Parser s a #

Query the internal state.

stUpdate :: (s -> s) -> Parser s () #

Update the internal state.

many1Satisfy :: (Char -> Bool) -> Parser s Text #

many1Satisfy p is a more efficient fused version of many1 (satisfy p)

manySatisfy :: (Char -> Bool) -> Parser s Text #

manySatisfy p is a more efficient fused version of many (satisfy p)

onFail :: Parser s a -> Parser s a -> Parser s a #

p onFail q means parse p, unless p fails, in which case parse q instead. Can be chained together to give multiple attempts to parse something. (Note that q could itself be a failing parser, e.g. to change the error message from that defined in p to something different.) However, a severe failure in p cannot be ignored.

satisfy :: (Char -> Bool) -> Parser s Char #

Return the next token if it satisfies the given predicate.

eof :: Parser s () #

Succeed if the end of file/input has been reached, fail otherwise.

next :: Parser s Char #

Simply return the next token in the input tokenstream.

newtype Parser s a #

This Parser datatype is a specialised parsing monad with error reporting. Whereas the standard version can be used for arbitrary token types, this version is specialised to Text input only.

Constructors

P (s -> Text -> Result (Text, s) a) 

Instances

Instances details
MonadFail (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

Methods

fail :: String -> Parser s a #

Alternative (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

Methods

empty :: Parser s a #

(<|>) :: Parser s a -> Parser s a -> Parser s a #

some :: Parser s a -> Parser s [a] #

many :: Parser s a -> Parser s [a] #

Applicative (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

Methods

pure :: a -> Parser s a #

(<*>) :: Parser s (a -> b) -> Parser s a -> Parser s b #

liftA2 :: (a -> b -> c) -> Parser s a -> Parser s b -> Parser s c #

(*>) :: Parser s a -> Parser s b -> Parser s b #

(<*) :: Parser s a -> Parser s b -> Parser s a #

Functor (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

Methods

fmap :: (a -> b) -> Parser s a -> Parser s b #

(<$) :: a -> Parser s b -> Parser s a #

Monad (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

Methods

(>>=) :: Parser s a -> (a -> Parser s b) -> Parser s b #

(>>) :: Parser s a -> Parser s b -> Parser s b #

return :: a -> Parser s a #

Commitment (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

Methods

commit :: Parser s a -> Parser s a #

adjustErr :: Parser s a -> (String -> String) -> Parser s a #

oneOf' :: [(String, Parser s a)] -> Parser s a #

PolyParse (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

data Result z a #

A return type like Either, that distinguishes not only between right and wrong answers, but also has commitment, so that a failure cannot be undone. This should only be used for writing very primitive parsers - really it is an internal detail of the library. The z type is the remaining unconsumed input.

Constructors

Success z a 
Failure z String 
Committed (Result z a) 

Instances

Instances details
Functor (Result z) 
Instance details

Defined in Text.ParserCombinators.Poly.Result

Methods

fmap :: (a -> b) -> Result z a -> Result z b #

(<$) :: a -> Result z b -> Result z a #

manyFinally' :: (PolyParse p, Show a) => p a -> p z -> p [a] #

manyFinally' is like manyFinally, except when the terminator parser overlaps with the element parser. In manyFinally e t, the parser t is tried only when parser e fails, whereas in manyFinally' e t, the parser t is always tried first, then parser e only if the terminator is not found. For instance, manyFinally (accept "01") (accept "0") on input "0101010" returns ["01","01","01"], whereas manyFinally' with the same arguments and input returns [].

manyFinally :: PolyParse p => p a -> p z -> p [a] #

manyFinally e t parses a possibly-empty sequence of e's, terminated by a t. The final t is discarded. Any parse failures could be due either to a badly-formed terminator or a badly-formed element, so it raises both possible errors.

bracket :: PolyParse p => p bra -> p ket -> p a -> p a #

Parse a bracketed item, discarding the brackets. If everything matches except the closing bracket, the whole parse fails soft, which can give less-than-satisfying error messages. If you want better error messages, try calling with e.g. bracket open (commit close) item

bracketSep :: PolyParse p => p bra -> p sep -> p ket -> p a -> p [a] #

Parse a list of items, discarding the start, end, and separator items.

sepBy1 :: PolyParse p => p a -> p sep -> p [a] #

Parse a non-empty list of items separated by discarded junk.

sepBy :: PolyParse p => p a -> p sep -> p [a] #

Parse a list of items separated by discarded junk.

many1 :: PolyParse p => p a -> p [a] #

Parse a non-empty list of items.

upto :: PolyParse p => Int -> p a -> p [a] #

'upto n p' parses n or fewer items, using the parser p, in sequence.

exactly :: PolyParse p => Int -> p a -> p [a] #

'exactly n p' parses precisely n items, using the parser p, in sequence.

oneOf :: PolyParse p => [p a] -> p a #

Parse the first alternative in the list that succeeds.

adjustErrBad :: PolyParse p => p a -> (String -> String) -> p a #

adjustErrBad is just like adjustErr except it also raises the severity of the error.

failBad :: PolyParse p => String -> p a #

When a simple fail is not strong enough, use failBad for emphasis. An emphasised (severe) error cannot be overridden by choice operators.

discard :: PolyParse p => p a -> p b -> p a infixl 3 #

x discard y parses both x and y, but discards the result of y. Rather like const lifted into parsers.

apply :: PolyParse p => p (a -> b) -> p a -> p b infixl 3 #

Apply a parsed function to a parsed value. Rather like ordinary function application lifted into parsers.

class Commitment (p :: Type -> TYPE LiftedRep) where #

The Commitment class is an abstraction over all the current concrete representations of monadic/applicative parser combinators in this package. The common feature is two-level error-handling. Some primitives must be implemented specific to each parser type (e.g. depending on whether the parser has a running state, or whether it is lazy). But given those primitives, large numbers of combinators do not depend any further on the internal structure of the particular parser.

Methods

commit :: p a -> p a #

Commit is a way of raising the severity of any errors found within its argument. Used in the middle of a parser definition, it means that any operations prior to commitment fail softly, but after commitment, they fail hard.

adjustErr :: p a -> (String -> String) -> p a #

p adjustErr f applies the transformation f to any error message generated in p, having no effect if p succeeds.

oneOf' :: [(String, p a)] -> p a #

Parse the first alternative that succeeds, but if none succeed, report only the severe errors, and if none of those, then report all the soft errors.

Instances

Instances details
Commitment (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

Methods

commit :: Parser s a -> Parser s a #

adjustErr :: Parser s a -> (String -> String) -> Parser s a #

oneOf' :: [(String, Parser s a)] -> Parser s a #

class (Functor p, Monad p, MonadFail p, Applicative p, Alternative p, Commitment p) => PolyParse (p :: Type -> Type) #

The PolyParse class is an abstraction gathering all of the common features that a two-level error-handling parser requires: the applicative parsing interface, the monadic interface, and commitment.

There are two additional basic combinators that we expect to be implemented afresh for every concrete type, but which (for technical reasons) cannot be class methods. They are next and satisfy.

Instances

Instances details
PolyParse (Parser s) 
Instance details

Defined in Text.ParserCombinators.Poly.StateText

The ParseDot class.

type Parse a = Parser GraphvizState a Source #

A ReadS-like type alias.

class ParseDot a where Source #

Minimal complete definition

parseUnqt

Instances

Instances details
ParseDot Version Source #

Ignores versionTags and assumes 'not . null . versionBranch' (usually you want 'length . versionBranch == 2') and that all such values are non-negative.

Instance details

Defined in Data.GraphViz.Parsing

ParseDot Word16 Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot Word8 Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot ArrowFill Source # 
Instance details

Defined in Data.GraphViz.Attributes.Arrows

ParseDot ArrowModifier Source # 
Instance details

Defined in Data.GraphViz.Attributes.Arrows

ParseDot ArrowShape Source # 
Instance details

Defined in Data.GraphViz.Attributes.Arrows

ParseDot ArrowSide Source # 
Instance details

Defined in Data.GraphViz.Attributes.Arrows

ParseDot ArrowType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Arrows

ParseDot BrewerName Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot BrewerScheme Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot ColorScheme Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot Color Source # 
Instance details

Defined in Data.GraphViz.Attributes.Colors

ParseDot WeightedColor Source # 
Instance details

Defined in Data.GraphViz.Attributes.Colors

ParseDot SVGColor Source # 
Instance details

Defined in Data.GraphViz.Attributes.Colors.SVG

ParseDot X11Color Source # 
Instance details

Defined in Data.GraphViz.Attributes.Colors.X11

ParseDot Attribute Source # 
Instance details

Defined in Data.GraphViz.Attributes.Complete

ParseDot Align Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot Attribute Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot Cell Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot CellFormat Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot Format Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot Img Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot Label Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot Row Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot Scale Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot Side Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot Style Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot Table Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot TextItem Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot VAlign Source # 
Instance details

Defined in Data.GraphViz.Attributes.HTML

ParseDot CompassPoint Source # 
Instance details

Defined in Data.GraphViz.Attributes.Internal

ParseDot PortName Source # 
Instance details

Defined in Data.GraphViz.Attributes.Internal

ParseDot PortPos Source # 
Instance details

Defined in Data.GraphViz.Attributes.Internal

ParseDot ClusterMode Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot DEConstraints Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot DPoint Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot DirType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot EdgeType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot FocusType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot GraphSize Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Justification Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Label Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot LabelScheme Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot LayerID Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot LayerList Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot LayerListSep Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot LayerRangeElem Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot LayerSep Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot ModeType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Model Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot NodeSize Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Normalized Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Number Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Order Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot OutputMode Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Overlap Source #

Note that overlap=false defaults to PrismOverlap Nothing, but if the Prism library isn't available then it is equivalent to VoronoiOverlap.

Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Pack Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot PackMode Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot PageDir Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Paths Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Point Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Pos Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot QuadType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot RankDir Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot RankType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Ratios Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot RecordField Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Rect Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Root Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot STStyle Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot SVGFontNames Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot ScaleType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Shape Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot SmoothType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot Spline Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot StartType Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot StyleItem Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot StyleName Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot VerticalPlacement Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot ViewPort Source # 
Instance details

Defined in Data.GraphViz.Attributes.Values

ParseDot GraphvizCommand Source # 
Instance details

Defined in Data.GraphViz.Commands.Available

ParseDot GlobalAttributes Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

ParseDot GraphID Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

ParseDot Text Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot Text Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot Integer Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot Bool Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot Char Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot Double Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot Int Source # 
Instance details

Defined in Data.GraphViz.Parsing

ParseDot n => ParseDot (DotGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

ParseDot n => ParseDot (DotStatements n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

ParseDot n => ParseDot (DotSubGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Canonical

ParseDot n => ParseDot (DotGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Generalised

ParseDot n => ParseDot (DotStatement n) Source # 
Instance details

Defined in Data.GraphViz.Types.Generalised

ParseDot n => ParseDot (DotSubGraph n) Source # 
Instance details

Defined in Data.GraphViz.Types.Generalised

(Ord n, ParseDot n) => ParseDot (DotGraph n) Source #

Uses the ParseDot instance for generalised DotGraphs.

Instance details

Defined in Data.GraphViz.Types.Graph

ParseDot n => ParseDot (DotEdge n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

ParseDot n => ParseDot (DotNode n) Source # 
Instance details

Defined in Data.GraphViz.Types.Internal.Common

ParseDot a => ParseDot [a] Source # 
Instance details

Defined in Data.GraphViz.Parsing

parseIt :: ParseDot a => Text -> (a, Text) Source #

Parse the required value, returning also the rest of the input Text that hasn't been parsed (for debugging purposes).

parseIt' :: ParseDot a => Text -> a Source #

Parse the required value with the assumption that it will parse all of the input Text.

runParser' :: Parse a -> Text -> a Source #

A variant of runParser where it is assumed that the provided parsing function consumes all of the Text input (with the exception of whitespace at the end).

runParserWith :: (GraphvizState -> GraphvizState) -> Parse a -> Text -> (Either String a, Text) Source #

parseLiberally :: GraphvizState -> GraphvizState Source #

checkValidParse :: Either String a -> a Source #

If unable to parse Dot code properly, throw a GraphvizException.

checkValidParseWithRest :: (Either String a, Text) -> a Source #

If unable to parse Dot code properly, throw a GraphvizException, with the error containing the remaining unparsed code..

Convenience parsing combinators.

ignoreSep :: (a -> b -> c) -> Parse a -> Parse sep -> Parse b -> Parse c Source #

The opposite of bracket.

onlyBool :: Parse Bool Source #

Use this when you do not want numbers to be treated as Bool values.

quotelessString :: Parse Text Source #

Parse a Text that doesn't need to be quoted.

isNumString :: Bool -> Text -> Bool Source #

Determine if this String represents a number. Boolean parameter determines if exponents are considered part of numbers for this.

quotedString :: Parse Text Source #

Used when quotes are explicitly required;

parseEscaped :: Bool -> [Char] -> [Char] -> Parse Text Source #

Parse a Text where the provided Chars (as well as " and \) are escaped and the second list of Chars are those that are not permitted. Note: does not parse surrounding quotes. The Bool value indicates whether empty Texts are allowed or not.

character :: Char -> Parse Char Source #

Assumes that any letter is ASCII for case-insensitive comparisons.

parseStrictFloat :: Bool -> Parse Double Source #

Parse a floating point number that actually contains decimals. Bool flag indicates whether values that need to be quoted are parsed.

whitespace1 :: Parse () Source #

Parses at least one whitespace character.

whitespace :: Parse () Source #

Parses zero or more whitespace characters.

wrapWhitespace :: Parse a -> Parse a Source #

Parse and discard optional surrounding whitespace.

newline :: Parse () Source #

Parses a newline.

newline' :: Parse () Source #

Consume all whitespace and newlines until a line with non-whitespace is reached. The whitespace on that line is not consumed.

tryParseList :: ParseDot a => Parse [a] Source #

Try to parse a list of the specified type; returns an empty list if parsing fails.

tryParseList' :: Parse [a] -> Parse [a] Source #

Return an empty list if parsing a list fails.

consumeLine :: Parse Text Source #

Parses and returns all characters up till the end of the line, but does not touch the newline characters.

commaSep :: (ParseDot a, ParseDot b) => Parse (a, b) Source #

commaSep' :: Parse a -> Parse b -> Parse (a, b) Source #

stringReps :: a -> [String] -> Parse a Source #