configuration-tools-0.7.1: Tools for specifying and parsing configurations
CopyrightCopyright © 2014-2015 PivotCloud Inc.
LicenseMIT
MaintainerLars Kuhtz <[email protected]>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Configuration.Utils.Internal

Description

 
Synopsis

Lenses

lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b Source #

over :: Setter s t a b -> (a -> b) -> s -> t Source #

set :: Setter s t a b -> b -> s -> t Source #

view :: MonadReader r m => ((a -> Const a a) -> r -> Const a r) -> m a Source #

type Lens' s a = Lens s s a a Source #

This is the same type as the type from the lens library with the same name.

In case it is already import from the lens package this should be hidden from the import.

type Lens s t a b = forall (f :: Type -> Type). Functor f => (a -> f b) -> s -> f t Source #

This is the same type as the type from the lens library with the same name.

In case it is already import from the lens package this should be hidden from the import.

type Setter' s a = Setter s s a a Source #

This is almost the same type as the type from the lens library with the same name.

In case it is already import from the lens package this should be hidden from the import.

type Setter s t a b = (a -> Identity b) -> s -> Identity t Source #

This is almost the same type as the type from the lens library with the same name.

In case it is already import from the lens package this should be hidden from the import.

type Iso' s a = Iso s s a a Source #

type Iso s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Profunctor p, Functor f) => p a (f b) -> p s (f t) Source #

This is the same type as the type from the lens library with the same name.

In case it is already import from the lens package this should be hidden from the import.

iso :: (s -> a) -> (b -> t) -> Iso s t a b Source #

Misc Utils

(&) :: a -> (a -> b) -> b infixl 1 #

& is a reverse application operator. This provides notational convenience. Its precedence is one higher than that of the forward application operator $, which allows & to be nested in $.

This is a version of flip id, where id is specialized from a -> a to (a -> b) -> (a -> b) which by the associativity of (->) is (a -> b) -> a -> b. flipping this yields a -> (a -> b) -> b which is the type signature of &

Examples

Expand
>>> 5 & (+1) & show
"6"
>>> sqrt $ [1 / n^2 | n <- [1..1000]] & sum & (*6)
3.1406380562059946

Since: base-4.8.0.0

(<&>) :: Functor f => f a -> (a -> b) -> f b infixl 1 #

Flipped version of <$>.

(<&>) = flip fmap

Examples

Expand

Apply (+1) to a list, a Just and a Right:

>>> Just 2 <&> (+1)
Just 3
>>> [1,2,3] <&> (+1)
[2,3,4]
>>> Right 3 <&> (+1)
Right 4

Since: base-4.11.0.0

sshow :: (Show a, IsString s) => a -> s Source #

exceptT :: Monad m => (e -> m b) -> (a -> m b) -> ExceptT e m a -> m b Source #

errorT :: Monad m => ExceptT Text m a -> m a Source #